forked from team-sg/hero-mark-2
fix some ladder bugs
This commit is contained in:
parent
19638bb520
commit
b5d985c834
1 changed files with 14 additions and 5 deletions
|
@ -310,11 +310,20 @@ func _process_climbing(delta: float) -> void:
|
||||||
elif Input.is_action_just_pressed("shoot"):
|
elif Input.is_action_just_pressed("shoot"):
|
||||||
global_position.x -= graphics.scale.x * 3.0
|
global_position.x -= graphics.scale.x * 3.0
|
||||||
state_chart.send_event("ladder_detach")
|
state_chart.send_event("ladder_detach")
|
||||||
if Input.is_action_pressed("ui_down") and is_on_floor():
|
# # auto-dismount on ground
|
||||||
var horizontal_dir = sign(Input.get_axis("ui_left", "ui_right"))
|
# elif Input.is_action_pressed("ui_down") and is_on_floor():
|
||||||
if sign(_attached_ladder.middle - global_position.x) != horizontal_dir:
|
# var horizontal_dir = sign(Input.get_axis("ui_left", "ui_right"))
|
||||||
global_position.x -= graphics.scale.x * 2.0
|
# if sign(_attached_ladder.middle - global_position.x) != horizontal_dir:
|
||||||
state_chart.send_event("ladder_detach")
|
# global_position.x -= graphics.scale.x * 3.0
|
||||||
|
# state_chart.send_event("ladder_detach")#
|
||||||
|
else:
|
||||||
|
var ladder_dir = sign(_attached_ladder.middle - global_position.x)
|
||||||
|
if ladder_dir >= 0.0:
|
||||||
|
global_position.x = _attached_ladder.left_snap
|
||||||
|
graphics.scale.x = 1.0
|
||||||
|
else:
|
||||||
|
global_position.x = _attached_ladder.right_snap
|
||||||
|
graphics.scale.x = -1.0
|
||||||
|
|
||||||
func _process_jump(delta: float) -> void:
|
func _process_jump(delta: float) -> void:
|
||||||
if velocity.y >= 0.0:
|
if velocity.y >= 0.0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue