no message
This commit is contained in:
25
sidescroller/scripts/playerjump.gd
Normal file
25
sidescroller/scripts/playerjump.gd
Normal file
@ -0,0 +1,25 @@
|
||||
extends State
|
||||
class_name PlayerJump
|
||||
|
||||
func get_state_name():
|
||||
return str(self).split(":")[0]
|
||||
|
||||
func enter():
|
||||
player.ap.play("jump")
|
||||
player.velocity.y = -player.jump_force
|
||||
func exit():
|
||||
pass
|
||||
func update(delta):
|
||||
|
||||
if player.transitionledgegrab():
|
||||
Transitioned.emit(self, "PlayerLedgeGrab")
|
||||
elif player.transitionfall():
|
||||
Transitioned.emit(self, "PlayerFall")
|
||||
elif !player.is_on_floor() and Input.is_action_just_pressed("jump") and (player.air_jumps_done < player.max_air_jumps):
|
||||
Transitioned.emit(self, "PlayerDoubleJump")
|
||||
elif player.is_on_floor() && player.velocity.x != 0:
|
||||
Transitioned.emit(self, "PlayerRun")
|
||||
elif player.is_on_floor():
|
||||
Transitioned.emit(self, "PlayerIdle")
|
||||
func physics_update(delta):
|
||||
pass
|
||||
Reference in New Issue
Block a user