[SOLVED] How to prevent screen shaking when objects are separated by collision?

Hi, this is my code lines:

When the player collides with the tree, the ‘move away’ function works and prevent them from overlapping. But I think the fact of the camera is centered on player, makes the screen shakes when the player ‘forces’ to walk through the tree.

How do I avoid the screen from shaking?

I hope I’ve been clear about my doubt.

Thanks a lot!

Swap the centre camera on player and the move player events. So you move the player first and then centre the camera.

Basically adding a condition on center camera action? Only when player is moving?

Not sure if I got it on practice. Sorry.

No, swap the two events in your screen snip around - so you do the move player events first, then the last event will be centre camera on player…

I had no idea that order matters.
I will try it tomorrow and give the fback!

Thanks again!

My general rule of thumb is to work out the all positions first, and move the camera as the very last action.


Just to add on MrMen, order matters ALOT in gdev. The engine essentially reads top to bottom.


Thanks, very useful info!

It worked!
Thanks a lot again!