Fire does not work correctly on iphone

xactoxacto Member Posts: 146
edited November -1 in Working with GS (Mac)
I am having issues creating a fire button on the iphone.

I first created a button that sends a TRUE value to the variable game.fingerPress. Then I placed the following code in my player actor:

http://farm3.static.flickr.com/2487/3937902767_cc938e4a42_o.png

If you run the game on the website... everything works. However on the iphone it will fire ALL powerups - no matter if the power up is 0, 1 or 2. It fires all of them at once.

Can anyone figure out why it is not firing the proper power-up on the iphone? (again, everything works ok on the web.

Thanks!

Xacto

------------------------
StarFire
http://gamesalad.com/game/play/8901

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Gah, I wrote out a long explanation and my internet went down as I posted!

    Basically, you need another variable in there to denote what type of shot you've got.

    Say

    Weapon = 1

    This will shoot your main weapon

    if you pickup a powerup then:

    Change attribute Weapon to 2.

    If you pickup another powerup

    Change attribute Weapon to 3.

    etc etc

    Then in your rule, you need to look for the weapon variable AND if the button is pressed.

    So the first one will be:

    If ALL these conditions are true

    If key = fire
    if finger is down
    if weapon = 1

    then fire laser.

    For the second -

    If ALL these conditions are true -
    If key = fire
    if finger is down
    if Weapon = 2

    Then fire powerup

    Hope that helps!

    Cheers,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • xactoxacto Member Posts: 146
    Hmmm.... I believe that is what Is already in the file. (see above link)

    "game.fingerdown" checks to see if your finger is down
    "game.powerup" is the same as "weapon 1" in your example. (game.powerup=0 is single shot, 1 is double shot, 2 triple shot)

    Maybe I am missing something?
  • quantumsheepquantumsheep Member Posts: 8,188
    That's not quite what I wrote mate!

    Use one rule for each powerup.

    So, as I said:

    If button is down
    Game powerup = 0

    then fire single shot

    New Rule:

    If button is down
    Game Powerup = 1

    Then fire double shot.

    I did it like that for one of my own games I'm sure - lemme check.

    /goes to check

    Yep, that's how I did it. There's just one rule per shot type.
    Check if button is pressed
    If weapon = 0

    Then shoot weapon 1.

    That's all one rule. Try a separate rule for each power up.

    Hope that helps,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • xactoxacto Member Posts: 146
    Quantum,

    My code is set up exactly like you describe. There is only one rule per shot, however it is nested within a "main rule" so I do not have to repeat the "if button is down" and "key=fire" command for each powerup.

    It looks like I figured it out... (you mentioned it in your first comment) I had ANY conditions is true for each powerup when it should have been ALL conditions are true. Thats why all my powerups were shooting at the same time. FixerNow it works!!!

    Thanks for your help.
  • quantumsheepquantumsheep Member Posts: 8,188
    No worries dude - glad you got it sorted! =D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.