Stupid question??!!

GuaveMediaGuaveMedia Member, PRO Posts: 1,262
edited February 2012 in Working with GS (Mac)
Hey,

I have a really stupid question. I don't know if I am gone crazy but yeah it's kinda making me crazy.
So I have an attribute. And I have two rules....

And I was having in the first rule ( short version)
When touch is pressed change this attribute to 1.

And when it is pressed again and has a value of 1, change it to 2.

But I don't get it fixed that it is always set immediately to 2....

Thank you guys for helping me out..

Alex

Comments

  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    edited February 2012
    Thank you tshirtbooth, but there is a different problem behind my question.

    The player has to choose from different objects, and it is a multiplayer game.
    So first, player 1 can choose a ball. And afterwards player two can choose. But in my case now, player1 and player2 wanna have the same ball.
    So I need first press attribute to 1 and second press to 2.
    Each time a sound should be played, now when it is set to 2 immediately, only one time the sounds gets played.

    And then he has to choose a bg, then the game starts...just for info

    thank you
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    There is no way like I have it now or?

    Alex
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Okey I have 5 balls.

    And the game is a multiplayer game. So each player ( 2 players total ), has the chance to select a ball that will be used in the game.
    So Player 1 has the chance to select first. And afterwards Player 2 can select his ball for the game.

    In my case now, both Players want to choose the same ball. And when player 1 selects a ball, an attribute gets set to 1. When Player 2 selects
    a ball the attribute gets set to 2. I need it at 2 because of some following rules. The problem or what I want to have is that this ball has
    to be pressed 2x to get to the value 2. Now when the ball gets pressed, the attribute changes to 2 immediately. I want the ball to be pressed 2x to be set to 2.

    Hope it is more clear now :)
  • zombieaddictzombieaddict Member Posts: 213
    instead of using "when touch is pressed" use "when touch is released". that way there won't be any overlap
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Hey
    thats the same effect...the same happens again :/
  • zombieaddictzombieaddict Member Posts: 213
    do you want me to look at the file?

  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Okey making my problem more easier:

    I want an actor to be touched two times. And at the first time an attribute should be set to 1. And second time it should be
    set to 2. The attribute should not get higher than 2 when touching this actor.

    Thank you...
  • zombieaddictzombieaddict Member Posts: 213
    when game.attribute > 2


    change game.attribute to 2
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    That would work but not in my case since this attribute is going bigger when an other item is chooses after the balls.

    :/
  • MotherHooseMotherHoose Member Posts: 2,456
    gameAttribute … index type … player1Ball
    gameAttribute … index type … player2Ball

    on ball:
    selfAttribute: my#
    Rule: when
    Event: touch is pressed
    --Rule: when
    ---Attribute: player1Ball = 0
    ----changeAttribute: game.player1Ball  To:  self.my#
    --Otherwise:
    --Rule: when
    ---Attribute: player2Ball = 0
    ----changeAttribute: game.player2Ball  To:  self.my#

    Rule: when (All)
    Attribute: game.player1Ball  >  0
    Attribute: game.player2Ball  >  0
    --Play Ball! stuff

    of course
    Rule: when
    Attribute: game/round over
    --changeAttribute: game.player1Ball  To:  0
    --changeAttribute: game.player2Ball  To:  0

    and to √ when the ball is used twice
    Rule: when
    Attribute: game.player1Ball  =  game.player2Ball
    -- whatever you have to do with the 2

    @};- MH
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Thank you but I already have all my play and game over rules.

    I just want that an actor has to get pressed two times and that an attribute switches first press to 1 and second press to 2.
    That's all....isn't there a simple way???

    Alex
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    Yes tshirt told you what to do.

  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Yeah basically yes, but he said when attribute =2 do that and that...
    But I have two rules, and in the second rule it only changes the attribute when the attribute =1. So it also sets
    it to 2 when touching it just once..
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    I need a way to touch an actor two times, each time getting the attribute one bigger. At all, the attribute should not get bigger than 2.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    I just read what you posted above, and unless you left something out, what he said will work just fine. If you have when touch is pressed change attribute to attribute+1, it will not set immediately to 2. Youll have to press it twice to get to 2
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    edited February 2012
    Ahh....

    it just made bang in my head an it works now..thank you :D
    of course to all of you that tried to help me..
Sign In or Register to comment.