Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

godot-demos/2018/04-24-finite-state-machine/ 'previous' not working #67

Open
1 task
MikyGus opened this issue Aug 15, 2020 · 0 comments
Open
1 task

Comments

@MikyGus
Copy link

MikyGus commented Aug 15, 2020

I'm submitting a...

  • [x ] Bug report.
  • Feature request.

Bug report

What is the current behavior?
The 'previous' functionality is not working

What is the expected behavior?
To go to the previous state

Tell us the steps to reproduce the bug, and if possible share a minimal demo of the problem.

Found the problem in '/player_v2/state_machine.gd'
func _change_state(state_name):
if not _active:
return
current_state.exit()

if state_name == "previous":
	states_stack.pop_front()
else:
	states_stack[0] = states_map[state_name] <-- **Remove this**
        states_stack.push_front(states_map[state_name]) <-- **Replace with this**

current_state = states_stack[0]
emit_signal("state_changed", current_state)

if state_name != "previous":  <-- **Remove this**
	current_state.enter() <-- **We whant to enter the previous state**
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant