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)