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:
14
princesse.gd
14
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:
|
||||
|
||||
Reference in New Issue
Block a user