#State parameters/prerequisite conflictions
14 messages · Page 1 of 1 (latest)
What about making state a variable that gets set rather than something returned by a function?
You would still need to decide what state you want in the situation where you have the player pressing both up and right, but the variable would ensure you could only be in one state at a time
It sounds like it would work, can you slightly guide me through how I can implement that if its not too much to ask?
First I would need an idea of what the state should represent.
I would start with an enum to keep track of possible states, and put in a variable in the object that can change states.
Then, in the place where you are using the function to get the state, I would just grab the value of the variable
I am unsure what your state is supposed to control
here i'll send an example of a couple states
this is the idle state
depending on what inputs are pressed in it, it returns a specific state
Right but what do you use it for?
Controlling the player if thats what you mean, unless you mean't something else in which i apologize