From 4411ad7e87a61234201cfc6488fb57595ca91f34 Mon Sep 17 00:00:00 2001 From: Thomas Lavocat Date: Fri, 26 May 2023 18:35:54 +0200 Subject: [PATCH] =?UTF-8?q?princesse/contr=C3=B4le=20a=C3=A9rien:=20meille?= =?UTF-8?q?ur=20feeling=20en=20l'air?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le contrôle aérien est rétabli correctement de manière globale. La princesse accélère et décélère 3 fois plus lentement dans l'air. Avec l'exception que ses deux premières frame d'accélération dans l'air sont immédaites pour un meilleur feeling bien connecté à la manette. --- princesse.gd | 14 +++++++++----- princesse.tscn | 5 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/princesse.gd b/princesse.gd index ad011c8..c40ee5e 100644 --- a/princesse.gd +++ b/princesse.gd @@ -157,8 +157,6 @@ func walk(direction:int) -> float: init_walk_state() return velocity.x - if velocity.x == 0 and not walking: - init_walk_state() # Si le personnage est dans l'air, il aura une friction plus faible lors de # la décélération. @@ -210,7 +208,15 @@ func walk(direction:int) -> float: walking_step = table.size() - 1 if walking: - walking_step = min(walking_step+1, X_SPEED_TABLE.size() -1) + walk_incr_reserve += 1 + # appliquer le nombre de frames nécéssaire pour décrémenter, dépend + # de où est le personnage (air vs sol) + if walking_step > 2: + if walk_incr_reserve >= threshold: + walk_incr_reserve = 0 + walking_step = min(walking_step+1, X_SPEED_TABLE.size() -1) + else: + walking_step+=1 init_decel = true else: # Lors de la première frame de la décélération, initialiser la valeur @@ -239,8 +245,6 @@ func walk(direction:int) -> float: return speed * direction + velocity.x else: return speed * direction - else: - init_walk_state() return velocity.x func fall() -> float: diff --git a/princesse.tscn b/princesse.tscn index 0414f1c..938ab89 100644 --- a/princesse.tscn +++ b/princesse.tscn @@ -263,13 +263,14 @@ slide_on_ceiling = false floor_constant_speed = true script = ExtResource("1_dkp7s") JUMPING_SPEED = 230 +KICK_JUMP_LIMITER = 0.73 COYOTE_LENGTH = 7 COYOTE_GRAB_LENGTH = 4 -WALK_INCR_AIR = 10 [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] sprite_frames = SubResource("SpriteFrames_q52wx") -animation = &"walk" +animation = &"falling_diagonals" +frame_progress = 0.975648 [node name="wall_detect_left" type="RayCast2D" parent="."] target_position = Vector2(-8, 0)