forked from team-sg/hero-mark-2
go to opposite side of ladder if at the top and holding direction (fixes #37)
This commit is contained in:
parent
5f3d907c3f
commit
ebdb4e51aa
2 changed files with 7 additions and 3 deletions
|
@ -109,7 +109,6 @@ func die() -> void:
|
||||||
func _on_Grounded_state_entered() -> void:
|
func _on_Grounded_state_entered() -> void:
|
||||||
# still jump if pressed frame hit ground
|
# still jump if pressed frame hit ground
|
||||||
if Input.is_action_just_pressed("jump"):
|
if Input.is_action_just_pressed("jump"):
|
||||||
print("BOING")
|
|
||||||
state_chart.send_event("jump")
|
state_chart.send_event("jump")
|
||||||
# toggle hurtbox shapes
|
# toggle hurtbox shapes
|
||||||
grounded_shape.disabled = false
|
grounded_shape.disabled = false
|
||||||
|
@ -190,7 +189,12 @@ func _on_Climbing_state_entered() -> void:
|
||||||
global_position.y -= get("collision/safe_margin")
|
global_position.y -= get("collision/safe_margin")
|
||||||
velocity = Vector2.ZERO
|
velocity = Vector2.ZERO
|
||||||
snap = Vector2.ZERO
|
snap = Vector2.ZERO
|
||||||
if global_position.x < _attached_ladder.middle:
|
var input_dir = sign(Input.get_axis("ui_left", "ui_right"))
|
||||||
|
var ladder_dir = sign(_attached_ladder.middle - global_position.x)
|
||||||
|
var flip = global_position.y - 1.0 <= _attached_ladder.global_position.y and input_dir == ladder_dir
|
||||||
|
print(ladder_dir)
|
||||||
|
print(flip)
|
||||||
|
if ladder_dir >= 0.0 != flip:
|
||||||
global_position.x = _attached_ladder.left_snap
|
global_position.x = _attached_ladder.left_snap
|
||||||
graphics.scale.x = 1.0
|
graphics.scale.x = 1.0
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1165,8 +1165,8 @@ script = ExtResource( 8 )
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"]
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"]
|
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"]
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"]
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"]
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"]
|
|
||||||
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement_grounded"]
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement_grounded"]
|
||||||
|
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Still" to="." method="_on_Still_state_entered"]
|
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Still" to="." method="_on_Still_state_entered"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Walking" to="." method="_on_Walking_state_entered"]
|
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Walking" to="." method="_on_Walking_state_entered"]
|
||||||
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Blinking" to="." method="_on_Blinking_state_entered"]
|
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Blinking" to="." method="_on_Blinking_state_entered"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue