diff --git a/objects/player/player_scholar.gd b/objects/player/player_scholar.gd index efc10d5..503950c 100644 --- a/objects/player/player_scholar.gd +++ b/objects/player/player_scholar.gd @@ -109,7 +109,6 @@ func die() -> void: func _on_Grounded_state_entered() -> void: # still jump if pressed frame hit ground if Input.is_action_just_pressed("jump"): - print("BOING") state_chart.send_event("jump") # toggle hurtbox shapes grounded_shape.disabled = false @@ -190,7 +189,12 @@ func _on_Climbing_state_entered() -> void: global_position.y -= get("collision/safe_margin") velocity = 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 graphics.scale.x = 1.0 else: diff --git a/objects/player/player_scholar.tscn b/objects/player/player_scholar.tscn index 459c4c9..28505d5 100644 --- a/objects/player/player_scholar.tscn +++ b/objects/player/player_scholar.tscn @@ -1165,8 +1165,8 @@ script = ExtResource( 8 ) [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_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_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/Walking" to="." method="_on_Walking_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Blinking" to="." method="_on_Blinking_state_entered"]