I wanted to use an enum for making my code more verbose. So i can have an enum named States and use that for the index variable when grabbing elements from an array. Aswell as i wanted to print the enum out.
But in both cases i run into the issue that i cant cast an enum to int or string. And in both cases it doesnt accept an enum as a viable type when calling an element in the array or when using the Print() function
I’m not sure this is implemented yet, in order to Print() anything, your variable type must be convertible to String by implementing the ToString() function like this : (example with a custom enum)
# Could probably put this at top level or in another utils/extensions file
ToString(State: zombie_state)<computes>:[]char =
case(State):
zombie_state.Idle => "Idle"
zombie_state.Walk => "Walk"
zombie_state.Run => "Run"
zombie_state.PrimaryAttack => "PrimaryAttack"
zombie_state.StrafeLeft => "StrafeLeft"
zombie_state.StrafeRight => "StrafeRight"
zombie_state.Backward => "Backward"
zombie_state.Hit => "Hit"
zombie_state.Dead => "Dead"