• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 Rotating and Moving the Camera View to the Player Object. Jittering/shaking Sprites

I am attempting to make a top down game with a boat/ship and the camera stays above/behind the players boat. I currently have a camera object that is locked on to the player object so that the player stays in the middle of the view. Basically when I turn the ship, the whole room is turning on the screen and the player ship does not move on the screen. The ship is staying in the same place in the middle of the screen. This works however the player sprite will jitter or shake while it moves after turning. I have tried using "floor" on movement and camera movement and it doesn't seem to make a difference. Here is the camera object step code:

//(ship sprite faces the right so I turned it 90 degrees to point the camera upwards with the ship)
//following variable is set to player ship object
camera_set_view_angle(view_camera[0],-following.image_angle + 90);
x = following.x;
y = following.y;

The player movement is a simple motion_set function using speed. Any help to make my sprites and camera smooth would be greatly appreciated. I have had little to no luck finding any information on code that turns the camera view to match the player object.

EDIT
Update, once I added floor(x) and y to my players end step event, the jitter stops. However when I try to turn the player ship it instantly stops. For some reason using floor on x and y causes my object speed to stop and bugs out.

Changing it to "round" instead makes the speed work fine. However now the object does not change direction. The sprite turns but the movement direction does not until it goes straight up or perfectly diagonal. (basically now direction only changes 8 directions but the sprite can keep turning)
 
Last edited:
Top