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

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2014

    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.

  • BBEnkBBEnk Member Posts: 1,764

    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

  • PhilipppuusPhilipppuus Member Posts: 62

    Thank you Socks. I'll try it tomorrow ^^. Good night!

  • PhilipppuusPhilipppuus Member Posts: 62

    thank you BBEnk. I'll try it later. Good night ! ^^

  • PhilipppuusPhilipppuus Member Posts: 62

    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 ?

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2014

    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

  • PhilipppuusPhilipppuus Member Posts: 62
    edited March 2014

    thx i try it ^^

  • PhilipppuusPhilipppuus Member Posts: 62

    THANK YOU SO MUCH !!! IT WORKS !!!!! You rule ^^

  • miroslavgegomiroslavgego Member Posts: 3

    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...

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    @miroslavgego The same way as above, except constrain self.color.alpha to "cheese". It's visibility will change when the button is pressed.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @bjandthekatz said:
    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

  • miroslavgegomiroslavgego Member Posts: 3

    @Socks said:
    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...

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @miroslavgego said:
    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...

  • miroslavgegomiroslavgego Member Posts: 3

    Thank you so much... :)

Sign In or Register to comment.