How do I make on 1 Actor an on/off Button?
Hi friends!
I tried everything but till now it doesn't work for me ^^. How do you make on one actor symbol 2 functions? I create 2 buttons (the first with the on funkction and the other with the off function.) It works perfectly but I want to make on/off in ONE actor.
I create in Game Attributes a Stop_Camera Boolean.
On one Actor I put
Rule
Actor receives event - touch - pressed
-Change Attribute - game.Stop_Camera - to:false
On the other Actor I put
Rule
Actor receives event - touch - pressed
-Change Attribute - game.Stop_Camera - to:true
I want in one Actor both function :-).
How do I do that?
thank you so much !!^^
Comments
Make an integer attribute - call it something exciting like "cheese".
Rule, when touched:
Change attribute cheese to 1-cheese.
This will toggle 'cheese' between 1 and 0.
Use a integer for game.Stop then in your touch rules change attribute make it say Change Attribute game.Stop too mod(game.stop+1,2) and that will toggle it on/off
Thank you Socks. I'll try it tomorrow ^^. Good night!
thank you BBEnk. I'll try it later. Good night ! ^^
Hmmm, it doesn't work.
I put on my Interface an on/off Button and I made a game.Stop integer too mod(game.stop+1,2), I did it what you told me BBEnk. But what should I write in the Camera Actor ?
Make an integer attribute - call it something exciting like "cheese".
Rule:
When touched: Change attribute cheese to 1-cheese.
(This will toggle 'cheese' between 1 and 0.)
Rule:
when cheese = 1 change attribute game.Stop_Camera to true
Otherwise change attribute game.Stop_Camera to false
thx i try it ^^
THANK YOU SO MUCH !!! IT WORKS !!!!! You rule ^^
How i make 2 functions in 1 actor... when i click 1st time on the background picture will open, when i click 2nd time picture will close...
@miroslavgego The same way as above, except constrain self.color.alpha to "cheese". It's visibility will change when the button is pressed.
If you just want switch an image on and off you don't need any attributes, just do this:
When touched: Change self.color.alpha to 1-self.color.alpha
I wanna with touch to change the direction of movement of the object... with first touch to go up with second to go down and continuously...
Thank you so much...