Support with Left and Right Spell

butterbeanbutterbean Member Posts: 4,315
edited November -1 in Working with GS (Mac)
So with the new viewer, and iphone touch controls, I've run into an inconsistency with the left and right spell.

So before the ipod touch controls were implemented:

In my main actor I had the rule (with boolean self attribute: Self.facing left)

When self.facing left is true:

Spawn actor: Left Spell for 1 second animate etc..

Same thing in the main actor with right spell:

When self.facingleft is false:

Spawn actor: Right spell for 1 second animate etc.

How would I implement itouch controls. I only want one shoot button for the spell.

Do I have to add 2 global game attributes called left and right spell, and have the button check that they are true to spawn spell?

Any help appreciated!

Comments

  • butterbeanbutterbean Member Posts: 4,315
    Anyone? I still haven't figured a way to do this with one fire button
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Make a boolean game attribute for 'Fire'. When you touch(pressed) the fire button, set the boolean to true. When touch(released) set the boolean to false.

    On your spawner,
    If LeftSpell is true AND Fire is true -> spawn the left spell
    If RightSpell is true AND Fire is true -> Spawn right spell.
  • butterbeanbutterbean Member Posts: 4,315
    I followed your rules and made a boolean attribute called "Fire"

    I set the Fire Button actor to the rules above:

    When touch is pressed, set fire to true

    When touch is released, set fire to false

    Also, in my main actor where the spell is spawned:

    I set for Right Spell (Self.facingleft is a boolean attribute telling her where she's facing)

    When self.facingleft is false ; When Game.fire is true

    Spawn Spell

    For Left Spell

    When self.facing left is true; When game.fire is true

    Spawn Spell

    The spell button is very inconsistent, and if anything, it doesn't work at all....

    Worked perfect when I had the keyboard controls in there before I changed them over to iphone controls.

    Anything I could be doing wrong here?

    Also, here's a link to one of the right spell rules that is under the main actor

    http://img85.imageshack.us/img85/376/picture1nx.png
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    That seems right. I added a demo.

    http://gamesalad.com/game/play/23210

    Though is it inconsistent when you are tapping the fire button? Because there is a 1 second delay when the spawn actor is kicked off. So if you tap fire, nothing will spawn until after the first second.
  • butterbeanbutterbean Member Posts: 4,315
    No it doesn't fire at all, it may work after a few minutes of tapping the fire button repeatedly, anything else that could be wrong?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Did you try just holding down the button? Does that work?
  • butterbeanbutterbean Member Posts: 4,315
    My thought was maybe the timer of the spell spawner is off or maybe the fire button should be set to a timer b/c of the delay in the firing of the spell?
  • butterbeanbutterbean Member Posts: 4,315
    Update:
    holding down does work! Thank you :)
    is there a way to get it to work better without holding the button down, and just tapping the button?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Add a spawn behavior outside of the timer. That should make it kick off the first spawn and subsequent firings should happen with the timer.
Sign In or Register to comment.