princesse/prout: gravité progressive
Si la princesse dash vers le haut, alors la gravité va reprendre progressivement.
This commit is contained in:
@@ -208,6 +208,9 @@ func fall() -> float:
|
|||||||
if jumping or kicking or dashing:
|
if jumping or kicking or dashing:
|
||||||
falling_step = -1
|
falling_step = -1
|
||||||
return velocity.y
|
return velocity.y
|
||||||
|
var intertia = 0
|
||||||
|
if velocity.y < 0:
|
||||||
|
intertia = max(velocity.y, -FALLING_SPEED)
|
||||||
if is_on_floor_only():
|
if is_on_floor_only():
|
||||||
if get_floor_normal()[0] < 0: # pente à gauche
|
if get_floor_normal()[0] < 0: # pente à gauche
|
||||||
if direction >= 0:# on va à droite, désactive la gravité
|
if direction >= 0:# on va à droite, désactive la gravité
|
||||||
@@ -225,8 +228,10 @@ func fall() -> float:
|
|||||||
if grab_wall:
|
if grab_wall:
|
||||||
falling_step = max(falling_step-1, 1)
|
falling_step = max(falling_step-1, 1)
|
||||||
else:
|
else:
|
||||||
|
if intertia < 0 and intertia + FALL_SPEED_TABLE[falling_step] * FALLING_SPEED >0:
|
||||||
|
falling_step = 0
|
||||||
falling_step = min(falling_step+1, FALL_SPEED_TABLE.size()-1)
|
falling_step = min(falling_step+1, FALL_SPEED_TABLE.size()-1)
|
||||||
return FALL_SPEED_TABLE[falling_step] * FALLING_SPEED
|
return intertia + FALL_SPEED_TABLE[falling_step] * FALLING_SPEED
|
||||||
|
|
||||||
func jump() -> float:
|
func jump() -> float:
|
||||||
# fait sauter princesse
|
# fait sauter princesse
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ collision_mask = 16
|
|||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
zoom = Vector2(2, 2)
|
zoom = Vector2(2, 2)
|
||||||
|
limit_smoothed = true
|
||||||
drag_horizontal_enabled = true
|
drag_horizontal_enabled = true
|
||||||
drag_vertical_enabled = true
|
drag_vertical_enabled = true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user