pythonarcade / arcade

Easy to use Python library for creating 2D arcade games.
http://arcade.academy
Other
1.71k stars 330 forks source link

Add direction to ScreenShake2D #2429

Closed bunny-therapist closed 1 week ago

bunny-therapist commented 1 month ago

Enhancement request:

What should be added/changed?

An argument, e.g., direction_deg,to arcade.camera.grips.ScreenShake2D which sets a constant angle for the shaking instead of changing it (_current_dir) randomly. If the argument is not provided(e.g., it is None), then the behavior is the same as now.

What would it help with?

Sometimes, one wants to have a directed shake. One common usecase that often appears in commercial platformers is a vertical screenshake when a heavy enemy lands on the ground. This would be a backwards compatible change that would make ScreenShake2D more versatile.

Currently, I am subclassing ScreenShake2D to implement this myself for directed shakes, but using regular ScreenShake2D for non-directed shakes.