ladder side dismount added and changed offset for dismount
This commit is contained in:
parent
2d0dd5b49a
commit
54c87088af
3 changed files with 31 additions and 11 deletions
|
@ -3,7 +3,7 @@
|
|||
[ext_resource path="res://objects/environment/ladder/ladder.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 8, 4 )
|
||||
extents = Vector2( 6, 4 )
|
||||
|
||||
[node name="Ladder" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
|
|
@ -155,7 +155,13 @@ func _process_climb():
|
|||
if Game.ac_climb.get_stream() != Game.a_climb_down: Game.play_sound(Game.a_climb_down,Game.ac_climb)
|
||||
if axis.y == 0: Game.ac_climb.set_stream(null)
|
||||
#Manual Jump,, only works when holding neutral or away from ladder
|
||||
if axis.x != sprite.scale.x: check_jump()
|
||||
if axis.x != sprite.scale.x && Input.is_action_just_pressed("jump"):
|
||||
position.x -= sprite.scale.x * 3
|
||||
velocity.y = -jump_force
|
||||
anims.set_speed_scale(1)
|
||||
current_state = State.FALL
|
||||
Game.ac_climb.set_stream(null)
|
||||
return
|
||||
if climb_ray.get_collider() == null:
|
||||
if axis.y == -1:
|
||||
#Auto Jump
|
||||
|
@ -165,6 +171,13 @@ func _process_climb():
|
|||
Game.ac_climb.set_stream(null)
|
||||
current_state = State.FALL
|
||||
return
|
||||
#Side dismount
|
||||
if axis.x != sprite.scale.x && Input.is_action_just_pressed("shoot"):
|
||||
position.x -= sprite.scale.x * 3
|
||||
current_state = State.FALL
|
||||
anims.set_speed_scale(1)
|
||||
Game.ac_climb.set_stream(null)
|
||||
return
|
||||
|
||||
|
||||
func _process_sword():
|
||||
|
@ -201,7 +214,7 @@ func check_jump():
|
|||
#Detach ladder
|
||||
if current_state == State.CLIMB:
|
||||
Game.ac_climb.set_stream(null) # stop climb sound
|
||||
position.x -= sprite.scale.x * 5
|
||||
position.x -= sprite.scale.x * 3
|
||||
else:
|
||||
dust_particles.restart()
|
||||
anims.set_speed_scale(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue