0 votes

extends Node
class_name FiniteStateMachine

var states : Dictionary = {}
var previousstate: int = -1
var state: int = -1 setget set

onready var parent: Character = getparent()
onready var animation
player: AnimationPlayer = parent.get_node("AnimationPlayer")

func physicsprocess(delta: float) -> void:
if state != -1:
var transition: int = gettransition()
if transition != -1:

func statelogic(_delte: float) -> void:

func gettransition() -> int:
return -1

func addstate(newstate: String) -> void:
state] = states.size()

func setstates(newstate: int) -> void:
previousstate = state
state = new
enterstate(previous_state, state)

func enterstate(previousstates: int, _newstate : int) -> void:

func exitstate(statedexited: int) -> void:

Godot version 3.2.2
in Engine by (14 points)

1 Answer

+1 vote

There is no function called setstate. You have a setstates.

by (286 points)

Nice :)
Sometimes we often make typos in writing code

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.