updated example of gravity application

This commit is contained in:
OddlyTimbot committed 2025-04-28 16:21:57 -04:00
1 parent efae634f41
commit bd25a4264e
1 file changed
+5 -2
+5 -2
View File
@@ -104,11 +104,14 @@ Note the addition of the state change to `State.JUMP`. That is the main thing we
```
if current_state == State.JUMP:
#apply normal gravity during up of jump action
#apply normal velocity
velocity += get_gravity() * delta
else:
#Character is falling, apply hard gravity
#apply hard gravity, character falling
velocity += get_gravity() * hard_gravity * delta
if velocity.y>0:
current_state = State.FALLING
```
Now if the player is in the "JUMP" state they get normal gravity, otherwise they get the hard gravity.