Maybe someone could help me out with this one please?
I have made a cube, which is turning clockwise around Z axis if i press W, and i managed to make E to be a button that changes state of W for cube to turn on negative Z axis - counter clockwise, but when E is being pressed in state2 it doesn’t turn W back into making the cube to rotatate on pisitive Z all tough it should as i got it to work after pressing E in state1.
Could someone look into a file that i have attached and maybe point out to me what i have done wrong?
Huge thanks in advance.
getstates.blend (458.8 KB)
Nevermind on this one i think i got it now after watching a tutorial
Remember that every state must have proper logic to move into any other desired state. For instance, “key down” in state1 might move to state2, but then “key up” in state2 might move back to state1.
It can help to draw a table – what programmers call a “state table,” with states along the top and stimuli along the side. In each applicable square, write down (first) what happens, and (then) what state this-state moves to.
A simple hand-drawn diagram, with circles representing states and arrow-lines (“arcs”) representing transitions can also be helpful.
Google things like “state diagram” and “finite-state machine (FSM).”
Thanks for that.
Getting states helped me to draw a bigger picture towards achieving many things that i had on my mind at least theoretically before i’d try throwing them into practice. For example this could change sets of physics generators used that would switch to other ones with higher or lower result values depending on object and it’s position on a line of tiles representing levels of generators to be used or switched to depending on a value stack of something like luck for items in characters overlay scene.
By mentioning Physics generators i was thinking about Game random 1 of 10 generator but of course for anyone else here this whole thing would be written in python but unfortunately i am not that good with coding for now. And i am probably not the only one who finds coding hard to learn as this kind of thing simply helps to visualize Your system and some aspects of game mechanics. I’m guessing, also some spinning wheels like clocks, with their arrows passing a single point to add a value for something with similar way of changing states of speeds could work for something like regeneration.
As you visualize the logic of your game, also consider this …
“State machine (FSM)” logic just happens to be a very-convenient way to subdivide(!) the logic within a system, through the rubric of describing it as “one-or-more independent ‘black boxes.’” (Which, by the way, very-often is necessary.) The “separation of concerns” that it buys you is more-or-less this:
(1) Your “main actor,” trying to decide what the player should do next, is presented with a shelf full of “FSM black-boxes.” So, he puts the current input into each of them, turns the crank, and responds to what(ever) each of them has given him.
(2) Each of the “black boxes on the shelf” are independent of all the others.
(3) Each of them is [independently…] described as a FSM = Finite-State Machine, responding only to its latest input and to its [invisible …] “present state” in order to determine what next to send to our “main actor.”
… “woo, hoo!” … welcome to programming! …