princesse/contrôle aérien: meilleur feeling en l'air

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.
This commit is contained in:
Thomas Lavocat
2023-05-26 18:35:54 +02:00
parent 8820877e78
commit 4411ad7e87
2 changed files with 12 additions and 7 deletions

View File

@@ -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:

View File

@@ -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)