Change image on touch --> touch again and change image to original
Hi all!
Please help me!
I have one actor and I want him to change image on touch. I have 2 images (one is white, second is yelow)
Original image is white and when touched it changes to yelow image.
And now i want to touch again to change it back to original white image.
How to do that??
Thanks!
Best Answers
-
jonmulcahy Posts: 10,408
what I would do (which may or may not be the best way) is to have a toggle switch. create a local attribute on the actor called toggle
when touch is pressed
change self.toggle to mod(toggle+1,2)with this rule, as you touch the actor it will increment the toggle attribute to 0,1,0,1,0,1.
so have another rule that says
when self.toggle is 0
change image to white
otherwise
change image to yellow -
Socks London, UK.Posts: 12,822
@kreso123456 said:
I figured it out! Thank you very much!You could just name your images 0 and 1.
Then use:
when touch is pressed change self.image to 1-self.image.
Answers
I am kinda new to the gamesalad, so if you could be more detailed.
"create a local attribute on the actor" - how to create local atribute?
Thank you on yore time!!
do i need to create integer or boolean or what?
I figured it out! Thank you very much!