Godot Version
4.2.2
Question
Hello guys, I’m having trouble with my TurnManager for my battle system. This is my code for the TurnManager
extends Resource
class_name TurnManagerenum {ALLY_TURN, ENEMY_TURN, RESOLVE}
signal ally_turn_started()
signal enemy_turn_started()
signal resolve_turn_started()var turn : int:
get:
return turn
set(value):
turn = value
match turn:
ALLY_TURN: emit_signal(“ally_turn_started”)
ENEMY_TURN: emit_signal(“enemy_turn_started”)
RESOLVE: emit_signal(“resolve_turn_started”)
This is how I am changing the turn, I have turn_manager load the TurnManager.gd script at the top and I connect to the signals in the onready function:
turn_manager.turn = TurnManager.ENEMY_TURN
When I try to run it though I get the error: Invalid set index ‘turn’ (on base: ‘GDScript’) with value of type ‘int’