#State parameters/prerequisite conflictions

14 messages · Page 1 of 1 (latest)

amber current
#

Either some type of interruption that cancels out one of the returning states or a Cancellation entirely

#

Or just different prerequisites

#

Any suggestions/help would be phenomenal

odd basin
#

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

amber current
#

It sounds like it would work, can you slightly guide me through how I can implement that if its not too much to ask?

odd basin
#

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

amber current
#

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

odd basin
#

Right but what do you use it for?

amber current
#

Controlling the player if thats what you mean, unless you mean't something else in which i apologize