cleaned up player script

This commit is contained in:
pennyrigate 2022-12-19 17:37:36 -05:00
parent 3ff6631f5f
commit 209884f133
7 changed files with 12 additions and 93 deletions

View file

@ -42,12 +42,16 @@ func _physics_process(delta):
continue
State.IDLE, State.WALK:
_process_idle_walk()
continue
State.JUMP:
_process_jump()
continue
State.FALL:
_process_fall()
continue
State.JUMP, State.FALL:
_process_jump_fall()
continue
State.CLIMB:
_process_climb()
continue
@ -103,25 +107,22 @@ func _process_idle_walk():
func _process_jump():
jump_pressure += 1
move(walk_speed,0,true)
check_double_jump()
#Pressure sensitive jump
if jump_pressure == 15 or Input.is_action_just_released("jump"):
velocity.y = -jump_force / 4
#velocity.y = 0
current_state = State.FALL
#Goto Shoot
check_shoot()
func _process_fall():
if anims.get_current_animation() != "doublejump": anims.play("jump")
check_double_jump()
#anims.play("jump")
move(walk_speed,0,true)
#Return to idle
if is_on_floor():
current_state = State.IDLE
return
func _process_jump_fall():
check_double_jump()
move(walk_speed,0,true)
#Goto Shoot
check_shoot()