allow switching sides of ladder (implements #212)
This commit is contained in:
parent
cb6a9e13f4
commit
8299648c98
3 changed files with 23 additions and 1 deletions
|
@ -267,10 +267,11 @@ func _on_Climbing_state_entered() -> void:
|
|||
if ladder_dir >= 0.0 != flip:
|
||||
global_position.x = _attached_ladder.left_snap
|
||||
graphics.scale.x = 1.0
|
||||
animation_player.play("climb")
|
||||
else:
|
||||
global_position.x = _attached_ladder.right_snap
|
||||
graphics.scale.x = -1.0
|
||||
animation_player.play("climb")
|
||||
animation_player.play("climb")
|
||||
|
||||
func _on_Climbing_state_exited() -> void:
|
||||
_attached_ladder = null
|
||||
|
@ -453,6 +454,12 @@ func _process_climbing(delta: float) -> void:
|
|||
# if sign(_attached_ladder.middle - global_position.x) != horizontal_dir:
|
||||
# global_position.x -= graphics.scale.x * 3.0
|
||||
# state_chart.send_event("ladder_detach")#
|
||||
elif Input.is_action_just_pressed("move_left") and _attached_ladder.can_climb_left:
|
||||
global_position.x = _attached_ladder.left_snap
|
||||
graphics.scale.x = 1.0
|
||||
elif Input.is_action_just_pressed("move_right") and _attached_ladder.can_climb_right:
|
||||
global_position.x = _attached_ladder.right_snap
|
||||
graphics.scale.x = -1.0
|
||||
else:
|
||||
var ladder_dir = sign(_attached_ladder.middle - global_position.x)
|
||||
if ladder_dir >= 0.0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue