Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | AUD_FOR_IUV |
I’m currently trying to implement screen shake in my 2D platformer game. In this game, most of the rooms are the size of the viewport, and the camera limits are set around each room, so the camera (which is centered on the player) only appears to move when the player transitions to a different room.
The problem is that the traditional method of implementing screen shake in Godot (i.e. modulating the offset
property in Camera2D
) doesn’t work here because offset
apparently obeys the limits of the camera. Ideally, the camera position itself would obey the limits and the offset wouldn’t so that I could apply screen shake effects without having to give up my nice camera limits.
Is this possible to do with the current camera limit/offset system? Or will I have to implement the limits/offset from scratch? I’ve noticed that many similar games (like Celeste and Hollow Knight) have screen shake effects even when the player has reached a room’s camera limits, so I’m hoping this is possible to do simply in Godot as well.
Thanks in advance for the help!
EDIT: After some discussion on Diet Estus’ similar thread, it was determined that the current behavior of the camera offset following the camera limits was indeed a bug. There’s now a pending pull request to fix the issue that’s slated for inclusion in the upcoming 3.2 release.
I asked essentially the same question earlier tonight. There should be a workaround involving directly shifting the default CanvasLayer
. Just haven’t perfected it yet because I don’t quite understand the Transform2D's
attributes. How to implement screenshake near camera limit? - Archive - Godot Forum
Diet Estus | 2019-07-05 06:53
Interesting, I might look into this later. Very eager to see the result if you manage to figure it out!
AUD_FOR_IUV | 2019-07-05 06:57