forked from team-sg/hero-mark-2
make top of ladder always be a jump (fixes #96)
This commit is contained in:
parent
ad59e73568
commit
b77ea88c50
2 changed files with 4 additions and 3 deletions
|
@ -258,7 +258,7 @@ func _process_pushing(delta: float) -> void:
|
||||||
func _process_climbing(delta: float) -> void:
|
func _process_climbing(delta: float) -> void:
|
||||||
# climbing movement
|
# climbing movement
|
||||||
var input_dir = sign(Input.get_axis("ui_up", "ui_down"))
|
var input_dir = sign(Input.get_axis("ui_up", "ui_down"))
|
||||||
velocity.y = input_dir * climb_speed # move in input direction
|
move_and_slide(Vector2(0.0, input_dir * climb_speed), Vector2.UP) # move
|
||||||
animation_player.playback_speed = abs(input_dir) # play/pause animation
|
animation_player.playback_speed = abs(input_dir) # play/pause animation
|
||||||
|
|
||||||
# play sound
|
# play sound
|
||||||
|
@ -284,6 +284,7 @@ func _process_climbing(delta: float) -> void:
|
||||||
# graphics.scale.x = 1.0
|
# graphics.scale.x = 1.0
|
||||||
|
|
||||||
# check if still on ladder
|
# check if still on ladder
|
||||||
|
ladder_detector.force_raycast_update()
|
||||||
if ladder_detector.get_collider() != _attached_ladder:
|
if ladder_detector.get_collider() != _attached_ladder:
|
||||||
if input_dir == -1.0:
|
if input_dir == -1.0:
|
||||||
state_chart.send_event("ladder_jump")
|
state_chart.send_event("ladder_jump")
|
||||||
|
|
|
@ -839,9 +839,9 @@ shape = SubResource( 16 )
|
||||||
|
|
||||||
[node name="LadderDetector" type="RayCast2D" parent="."]
|
[node name="LadderDetector" type="RayCast2D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
position = Vector2( 0.5, 0 )
|
position = Vector2( 0.5, -0.5 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 0, -10 )
|
cast_to = Vector2( 0, -9.5 )
|
||||||
collision_mask = 64
|
collision_mask = 64
|
||||||
collide_with_areas = true
|
collide_with_areas = true
|
||||||
collide_with_bodies = false
|
collide_with_bodies = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue