This is a bite-sized tutorial on shaking the screen in tModLoader [1.4.3]. It's usually used in boss fights and "heavy" weapons. Here's how you can implement it:
To add screenshake, we use the ModifyScreenPosition
hook in ModPlayer
. Let's make a new .cs
file in a Players
folder (for organization; this is usually good for beginners but you can decide where to put it). Here's what our code would look like:
public class ScreenshakePlayer : ModPlayer
{
public int screenshakeTimer;
public int screenshakeMagnitude;