Forum Discussion
Change States When Object is Clicked on Multiple Times
Is there a way to change the state of the same object multiple times, simply by clicking on the object? For example, I want to change a shape from red to blue to green by clicking on the shape. This should be continuous. So as long as I keep clicking the colors will change in order.
I am guessing I have to use variables?
Thanks
John
19 Replies
- GeorgeTuftCommunity Member
Thanks Wendy...I had been just about to do exactly that!
Great minds... :)
So, I'm still confused as to why Rebecca's file works, but mine doesn't.
She's using no variables, and only referring to the actual state of the object.Is it because she's got a NORMAL state that matches the BLUE state, and that's allowing for the progression somehow?
- WendyFarmerSuper Hero
Hi George
I edited Beccy's file to show the name on the state - as you can see it never touches the 'BLUE' state.
I also added in a slide with just two states and it behaves the same as your's changes state once but not again.
Hence the use of variable.
- VivianaZavalaCommunity Member
Wendy - I realize this is an old post but THANK YOU if you ever read this. I still can't quit wrap my head around the sequencing triggers but I followed your directions to a tee and it worked!!! You rock. Viviana
- WaltHamiltonSuper Hero
George,
What an eye-opener this has been for me. Your Character never changed to calm because of the order of the triggers. When the first trigger found him angry, it turned him to calm. Then the second trigger found him calm and turned him back to angry. (Changing the order of the triggers would make him always calm and never angry, for the same reasons.) I always thought that only the last state persisted, but looking at Rebecca's file, I realize that in reality, only the first state is never used. Her blue state is never seen, because her last trigger always turns blue to normal. Since they are identical, nobody notices.
I did the same with your sample. I duplicated the calm state, and called it New State, set up the triggers, and now you can click him and he toggles between calm and angry. The difference is that there are three states, and the one associated with the first trigger is never used, so he looks to be switching between two states. (I did add a little color to the New State to make it obvious what is happening.)
You may need to change the order of the triggers, and maybe duplicate the angry state. Depending on his initial state, it may take two clicks to change him the first time.
- GeorgeTuftCommunity Member
Thanks all!
It looks like I have both a variable, and a non-variable solution. :)
And Walt, to clarify...
It looks like Rebecca's non-variable solution works because the Normal and Blue states match, and that the Blue state instantly flips to Normal.Am I reading that right?
- WaltHamiltonSuper Hero
yes
- LisaListama-b25Community Member
Thank you to the 2014 crew who made this thread! It just solved a massive issue a friend of mine was having and I was trying to fix it for her. THANK YOUUUUUUUU
Related Content
- 10 months ago
- 4 months ago