How to say - when touch is released, or when your finger isn't on the screen, to proceed.

Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
edited February 2012 in Working with GS (Mac)
Hey guys,

I know this sounds simple, but I can't get my head around it. In my game you can shoot things.
I would like it so that when you shoot, and release your your finger from the screen, and when the orb has stopped (see below for more description), then you can tap and shoot again. I don't want it so you can keep shooting at the exact same place.

I have some attributes that are like this:

Rule:
When game.start true
When game.can shoot true
When game.touch count is greater then 1
When touch is pressed,

Change attribute game.shoot to true.
-----

Now, it shoots out an orb, and the orb moves etc until it stops.
Then, it changes game.can shoot to true when it's stopped.

So I hope this makes sense.
Any help would be great!

Braydon

Comments

  • POMPOM Member Posts: 2,599
    If you want to check when your finger is 'off the screen' I find it best to use
    When touch count = 0
    Trigger what you want..

    Photobucket Roy
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Hey @P-O-M,

    Not sure I understand. Love the squirrel, though. ;)
    Touch count is in there because when the game is over, a game over sign comes down over the screen. You tap that and it goes away.
    I did this so it doesn't shoot out another ball right away just because you tapped the replay button on the You Lose actor. :P
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Yep like pom said you can do touch count=0, or when mouse button is up to check if your not touching anything
  • POMPOM Member Posts: 2,599
    You said you want to trigger , or allow an action only when the user is lifting his finger from the screen..
    So basically,
    When touch count = 0
    Change attribute "game.allow process" to true..

    Photobucket Roy
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Hey Roy,

    No,
    In the game, when touch is pressed, it shoots out a ball. Then, when the ball stops moving, it set it back so you can shoot again. But if your finger is still on the screen, it will just shoot another ball in the same exact position. Which, isn't a big problem, but it could be considered cheating in this certain game. :)

    So, I want it so when you can shoot, to check if your finger is off the screen. Or better yet, when it stops growing to check, then set it so you can shoot if your finger is off.

    Hope this makes sense.
  • POMPOM Member Posts: 2,599
    It makes perfectly sense mate ;)
    But the answer is still the same..
    When "Game.allow process" IS true
    When touch is pressed
    Spawn ball
    Change "Game.allow process" TO false

    Now new rule:
    When touch count = 0
    Change "Game.allow process" TO true ;)

    Photobucket Roy
  • MotherHooseMotherHoose Member Posts: 2,456
    when ball is moving … ignore the touch?

    gameAttribute: ballMoving

    ballActor:
    Rule: when (Any)
    Attribute: self.Motion.Linear Velocity.X > 0
    Attribute: self.Motion.Linear Velocity.Y > 0
    --changeAttribute: game.ballMoving To: 1
    Otherwise:
    --changeAttribute: game.ballMoving To: 0

    shooterActor:
    Rule: when
    Event: touch is pressed
    --Rule: when
    ---Attribute: game.ballMoving is 0
    ---fire the ball

    @};- MH
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited February 2012
    Hey Roy,

    That seemed to fix it, thanks m8. :)

    EDIT: oops, just saw your comment, MH. Thanks for you help too.
  • POMPOM Member Posts: 2,599
    No problem :)
    Glad you sorted it out

    Photobucket Roy
Sign In or Register to comment.