error (6,1): The setter function isn't defined

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fedeshimo

extends Node
class_name FiniteStateMachine

var states : Dictionary = {}
var previous_state: int = -1
var state: int = -1 setget set_state

onready var parent: Character = get_parent()
onready var animation_player: AnimationPlayer = parent.get_node(“AnimationPlayer”)

func _physics_process(delta: float) → void:
if state != -1:
var transition: int = _get_transition()
if transition != -1:

func _state_logic(_delte: float) → void:

func _get_transition() → int:
return -1

func _add_state(new_state: String) → void:
states[new_state] = states.size()

func set_states(new_state: int) → void:
previous_state = state
state = new_state
_enter_state(previous_state, state)

func _enter_state(previous_states: int, _new_state : int) → void:

func _exit_state(_stated_exited: int) → void:

:bust_in_silhouette: Reply From: Ev1lbl0w

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

Nice :slight_smile:
Sometimes we often make typos in writing code

sarapan_malam | 2022-09-03 19:29