From bd25a4264e51d8d636f4709d6de5364d3c3c27e7 Mon Sep 17 00:00:00 2001 From: OddlyTimbot Date: Mon, 28 Apr 2025 16:21:57 -0400 Subject: [PATCH] updated example of gravity application --- week3/character_update.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/week3/character_update.md b/week3/character_update.md index 8692355..a131431 100644 --- a/week3/character_update.md +++ b/week3/character_update.md @@ -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.