GameSalad

Need Help with my 3 buttons problem

kianziackkianziack Posts: 28
edited February 28 in Working with GS (PC)

I have 3 buttons on screen (sample A,B and C).
What I want to do is to restrict the other two buttons sample B and C when im pressing the A button. After pressing A, that's the only time I can press/touch either one of remaining buttons, the same rules apply if I press on any buttons. Pressing/touch twice also restricted,

Please help thanks in advance.

Oh I think i'm on the wrong category I dont know how to move it.

Comments

  • ToqueToque Posts: 790
    edited February 28

    Are you trying to say if one of these buttons pressed then none will work?

    game Boolean attribute

    In all buttons have same rule.

    If pressed change Boolean to true.

    In all buttons. Conditions to trigger. All

    If button pressed
    Game Boolean false

    Do whatever button does.

    Hmmmm. I read you question again but now I find it illogical.
    You want to restrict and require the same thing.
    Sorry I'm confused. Require A to be pressed before BC. But if A is pressed BC can no long be pressed???? Sorry maybe I reading it wrong.

  • imjustmikeimjustmike Posts: 418

    Yeah, I'm not 100% clear either.

    Are you saying that you can only press any one button if another button is also pressed? That doesn't quite make sense? You could have an attribute, game.button_is_pressed that is triggered anytime a button is pressed, and use that with touch is pressed to trigger rules.

    Or is it more specific, you have a button, A, which is your master button. You can only press other buttons, B and C (and others) if A is pressed?

    If it's that, it's simple. Just have a global boolean attribute game.a_is_pressed that is triggered when button A is pressed. Then, in your B and C buttons, have your behaviours only trigger when both game.a_is_pressed AND touch is pressed

  • kianziackkianziack Posts: 28
    edited February 28

    Thanks for the reply, but I have already figured out on how to make it work and I'm sorry if my explanation is hard to understand. Even me it took me an hour to elaborate what I really want to achieve here. And also am not that good in English >_<'

    Anyhow this is what i did.

    Game Attribute
    tapmeonce 0 integer

    on screen
    Timer
    Every 0.5
    change attribute
    game.tapmeonce to game.tapmeonce+1

    Rules
    if game.tapmeonce= 2
    DO
    Change attribute to 0

    1st effect
    when i press A buttons, B and C wont function
    When I press B buttons, A and C wont function
    When I press C buttons, B and A wont function

    2nd effect
    double tap wont work or double press

    3rd effect
    you got to wait for 2 seconds before you can press any letters

    so far it is working fine. but still am not done with my project >_<'

  • imjustmikeimjustmike Posts: 418

    Glad you got it working. Good luck with the rest of your project.

  • kianziackkianziack Posts: 28
    edited February 28

    This is what i am working on.
    the game has 3 cannon on the left side of the screen and then 3 cannons on the right side.

    On the left side I used (UP ARROW) for my 1st cannon to pull the trigger, (LEFT ARROW) for my 2nd cannon and (DOWN ARROW) for my 3rd cannon

    on the right side I used (Y) for my 1st cannon to pull the trigger, (B) for my 2nd cannon and (A) for my 3rd cannon

    The Idea of the game is:

    1) All cannons have only one bullet and it takes 2 second to reload, So I have to use either one of the cannon that have already finished reloading.

    2) only one button at a time, well one on the right side and one on the left side.

    What I want to happen:

    Cannon must fire only one bullet and then takes 2 second to reload

    Cannon must fire one at a time

    Sample: if I press Y, B and A is disable until my finger is off on Y button from pressing then B and A is available to fire but I can only press one button and then chose another button after releasing and so on.

    Note: The gorilla randomly respawn up, down and on the middle.

    Ohh This one has an issue so I still need Help T_T

    @kianziack said:
    Thanks for the reply, but I have already figured out on how to make it work and I'm sorry if my explanation is hard to understand. Even me it took me an hour to elaborate what I really want to achieve here. And also am not that good in English >_<'

    Anyhow this is what i did.

    Game Attribute
    tapmeonce 0 integer

    on screen
    Timer
    Every 0.5
    change attribute
    game.tapmeonce to game.tapmeonce+1

    Rules
    if game.tapmeonce= 2
    DO
    Change attribute to 0

    1st effect
    when i press A buttons, B and C wont function
    When I press B buttons, A and C wont function
    When I press C buttons, B and A wont function

    2nd effect
    double tap wont work or double press

    3rd effect
    you got to wait for 2 seconds before you can press any letters

    so far it is working fine. but still am not done with my project >_<'

  • ToqueToque Posts: 790

    Looks interesting.

  • SocksSocks London, UK.Posts: 12,457

    I would have made all three buttons a single actor, and done something like this . . .

    When touch is > self.Y+100 then A
    --Otherwise When touch is < self.Y-100 then B
    ----Otherwise C

  • pHghostpHghost London, UKPosts: 1,885

    @Socks said:
    When touch is > self.Y+100 then A

    If I understand it correctly, I think he is going for button controls, not touch controls.

    @kianziack Can you confirm? Or both?

  • SocksSocks London, UK.Posts: 12,457

    @pHghost said:
    If I understand it correctly, I think he is going for button controls, not touch controls.

    What's the difference ?

  • pHghostpHghost London, UKPosts: 1,885

    @Socks said:
    What's the difference ?

    What I mean is physical button controls, in which case touch would always be 0 and touch is > self.Y+100 then A would never trigger (unless self.Y were -100, but then only this one button would ever trigger). Or I might be misunderstanding what you mean.

  • SocksSocks London, UK.Posts: 12,457

    @pHghost said:

    @Socks said:
    What's the difference ?

    What I mean is physical button controls, in which case touch would always be 0 and touch is > self.Y+100 then A would never trigger (unless self.Y were -100, but then only this one button would ever trigger).

    Ah! I see what you mean now !

  • kianziackkianziack Posts: 28
    edited March 1

    Note: The gorilla randomly respawn up, down and middle. > @pHghost said:

    @Socks said:
    When touch is > self.Y+100 then A

    If I understand it correctly, I think he is going for button controls, not touch controls.

    @kianziack Can you confirm? Or both?

    Well both yes. Tuch and buttons.

  • kianziackkianziack Posts: 28
    edited March 4

    Finally, I found a way to make it work, I feel great that I want to share it on how I did it.

    Game Atribute
    cannonright 0 Integer
    cannonleft 0 integer

    Game Rule on screen
    Rule
    atribute
    if cannonright = 10
    Do
    timer after 0.1 run to completion checked
    change attribute
    game.cannonleft to 0

    Rule
    atribute
    if cannonright = 20
    Do
    timer after 0.1 run to completion checked
    change attribute
    game.cannonleft to 0

    Rule
    atribute
    if cannonright = 30
    Do
    timer after 0.1 run to completion checked
    change attribute
    game.cannonleft to 0

    Game Rule on screen
    Rule
    atribute
    if cannonleft = 10
    Do
    timer after 0.1 run to completion checked
    change attribute
    game.cannonleft to 0

    Rule
    atribute
    if cannonleft = 20
    Do
    timer after 0.1 run to completion checked
    change attribute
    game.cannonleft to 0

    Rule
    atribute
    if cannonleft = 30
    Do
    timer after 0.1 run to completion checked
    change attribute
    game.cannonleft to 0

    First actor
    Bullet left direction 180degree at acceleration 900
    Rule
    actor overlaps or collide with actor type Gorrila monster

    Second actor
    Bullet right direction 0 degree at acceleration 900
    Rule
    actor overlaps or collide with actor type Gorrila monster

    Actor cannon bullet caller right 1
    Rule
    Any
    attributes
    if game.cannonright = 10
    Do
    Spawn Actor
    bullet right place in front of actor
    in direction 0 relatice to actor
    from position 0 , 0 relative to actor
    Destory this actor
    Spawn actor
    spawn actor call again place in front of actor
    in direction 0 relatice to actor
    from position 0 , 0 relative to actor

    Actor cannon bullet caller right 2
    Rule
    Any
    attributes
    if game.cannonright = 20
    Do
    Spawn Actor
    bullet right place in front of actor
    in direction 0 relatice to actor
    from position 0 , 0 relative to actor
    Destory this actor
    Spawn actor
    spawn actor call again place in front of actor
    in direction 0 relatice to actor
    from position 0 , 0 relative to actor

    Actor cannon bullet caller right 3
    Rule
    Any
    attributes
    if game.cannonright = 30
    Do
    Spawn Actor
    bullet right place in front of actor
    in direction 0 relatice to actor
    from position 0 , 0 relative to actor
    Destory this actor
    Spawn actor
    spawn actor call again place in front of actor
    in direction 0 relatice to actor
    from position 0 , 0 relative to actor

    Actor call again
    Timer
    After 1 seconds Run to completion checked
    Spawn actor cannon bullet caller right place in front of actor
    in direction 0 relatice to actor
    from position 0 , 0 relative to actor
    destroy

    Now for the controls

    Right cannon
    (Sample only)
    Rule
    Receives a key Up arrow is down
    Do
    Change Attribute
    set game.cannonright to game.cannonright+10

    Right cannon
    (Sample only)
    Rule
    Receives a key left arrow is down
    Do
    Change Attribute
    set game.cannonright to game.cannonright+20

    Right cannon
    (Sample only)
    Rule
    Receives a key down arrow is down
    Do
    Change Attribute
    set game.cannonright to game.cannonright+30

    Thats how I do it, I hope you guys Understand it well.

  • ToqueToque Posts: 790

    Great.

Sign In or Register to comment.