check internal state in _input()

master
Fabien Freling 2020-02-19 13:40:05 +01:00
parent 7b25ae028b
commit 23ca5db700
2 changed files with 9 additions and 5 deletions

View File

@ -19,6 +19,8 @@ func current_state_name() -> String:
return State.keys()[current_state]
func transition_to(state):
if current_state == state:
return
assert(state in transitions[current_state])
var previous_state = current_state
current_state = state

View File

@ -87,6 +87,13 @@ func _ready() -> void:
shuffle(difficulty)
func _process(delta):
pass
func _input(event):
if $AnimationPlayer.is_playing():
# Disable input during animation
return
var game_state = get_node_or_null("/root/Main/GameState") as GameState
if game_state != null:
match game_state.current_state:
@ -97,11 +104,6 @@ func _process(delta):
GameState.State.GAME_OVER:
return
func _input(event):
if $AnimationPlayer.is_playing():
# Disable input during animation
return
#
# Handle keyboard input
#