Touch once turns attribute true touch again turns it false?

Player_EPlayer_E Member, PRO Posts: 604
edited November -1 in Working with GS (Mac)
I want to be able to touch an actor once and turn a boolean attribute true, then touch it again and turn it false. Basically every touch turns it on then off, then on again

any thoughts?

Comments

  • DanielADanielA Member Posts: 101
    Heres one idea.
    Rule: Boolean = true + touch is pressed. Change boolean to 0
    Rule: Boolean = false + touch is pressed. Change boolean to 1
  • ChaserChaser Member Posts: 1,453
    I would set it up so that touch the actor change attribute true then spawn another actorthat looks the same. Destroy old actor. The new actor will have the same set up except touch is pressed change false. So you never realize you are touching a different actor
  • Player_EPlayer_E Member, PRO Posts: 604
    I'll try it out Daniel I think that its pretty simple and might work well. If it doesn't then ill try yours chaser.

    Thanks for the help guys.
  • Player_EPlayer_E Member, PRO Posts: 604
    Thanks once again Tshirt it works great!

    But here is another brain buster i'm having. I now have multiple of the same actor on my screen and I want the above feature to apply.

    the issue is this. If I just use
    change attribute game.???? to (game.????+1)%2
    When i touch another actor the numbers get mixed up and everything goes to hell.

    Now I tried to introduce a self.attribute with the same properties.

    This is what I have worked out so far:
    When I touch 1st actor both the self and the game attribute turn to 1. and when I try to touch actor 2 (with game attribute still at 1) the game attribute stays at 1 and the 2nd actors self attribute stays at 0.

    That is perfect exactly what I want.

    Now the issue
    When I touch actor 1 again expecting to turn self attribute and game attribute back to 0 it does not.

    How would I work this out?

    im off to work and will be back on tonight so hopefully I can go back at it tonight and see what I can get working
  • Player_EPlayer_E Member, PRO Posts: 604
    Player_E said:
    Thanks once again Tshirt it works great!

    But here is another brain buster i'm having. I now have multiple of the same actor on my screen and I want the above feature to apply.

    the issue is this. If I just use
    change attribute game.???? to (game.????+1)%2
    When i touch another actor the numbers get mixed up and everything goes to hell.

    Now I tried to introduce a self.attribute with the same properties.

    This is what I have worked out so far:
    When I touch 1st actor both the self and the game attribute turn to 1. and when I try to touch actor 2 (with game attribute still at 1) the game attribute stays at 1 and the 2nd actors self attribute stays at 0.

    That is perfect exactly what I want.

    Now the issue
    When I touch actor 1 again expecting to turn self attribute and game attribute back to 0 it does not.

    How would I work this out?

    im off to work and will be back on tonight so hopefully I can go back at it tonight and see what I can get working

  • netdzynrnetdzynr Member Posts: 296
    I would use a combination of what DanielA suggested and the self attribute you mention. Create a boolean state in the actor called myState (or whatever you want) and set the default value (false if that makes sense). You can use this:
    Rule: touch is pressed
    > Rule:
    > Attribute: self.myState is true
    > Change Attribute: self.myState to false
    > Otherwise:
    > Change Attribute: self.myState to true
Sign In or Register to comment.