bovido/scripts/player/states/player_idle_state.gd

22 lines
544 B
GDScript3
Raw Normal View History

class_name PlayerIdleState
extends PlayerState
2023-06-28 00:07:13 +02:00
var player_collide_with_ball = false
func enter(_msg := {}):
player.velocity = Vector2.ZERO
player.animation_player.play("idle")
func update(_delta):
2023-06-28 00:07:13 +02:00
if player_collide_with_ball && Input.is_action_pressed("hit"):
state_machine.transition_to("Hit")
if player.get_input_direction() != Vector2.ZERO:
state_machine.transition_to("Walk")
2023-06-28 00:07:13 +02:00
func _on_player_ball_starts_colliding():
player_collide_with_ball = true
2023-06-28 00:07:13 +02:00
func _on_player_ball_stops_colliding():
player_collide_with_ball = false