Registering/Not Registering a Touch/Mouse is Down

921creative921creative Member, PRO Posts: 140
edited March 2012 in Working with GS (Mac)
I have a character who is controlled by essentially mousing down (or touching) the screen--he goes in the direction of your finger. I also have special tips that pop up at the start of certain levels to give help and advice, and these tips must be dismissed with a touch before the character can be controlled and the level starts.

The problem is, dismissing the tip also sometimes starts the character moving even though he's not supposed to move yet. I have the character in a rule that only allows him to move if scene.Ready is true. Dismissing the tip changes scene.Ready to true after half a second.

This problem does not occur all the time, just randomly and it is a big problem because the character will just start moving to and rotating around the spot where the user touched to dismiss the tip, and this could cause a great deal of confusion to the user.

How can I absolutely force the character not to move when touch is pressed to dismiss the tip? I've tried numerous rules and timers but I can't get rid of this problem.

Best Answer

  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    when you have multiple sequential/lateral events in your game …

    you have created a flow … that your game should monitor
    and actors events should be activated by the flow of the game

    one index type gameAttribute… named sceneFlow …
    may give you better/easier control of what happens when

    EXAMPLE:

    one your tipsActor:

    1st behavior … changeAttribute: game.sceneFlow To: 0

    Rule: when
    Attribute: game.sceneFlow = 0
    --here you could set the correctPosition X and Y for displaying the tips
    --Rule: when
    Event: touched is pressed
    --changeAttribute: game.sceneFlow To: 1
    Otherwise:
    --changeAttribute: self.Position.X or Y To: offScreen position
    or Destroy behavior

    on your characterActor:
    Rule: when
    Attribute: game.sceneFlow = 1
    --the touch rules

    at anytime you change the Flow to 2 or more … with/for other actions/events

    and when the scene is complete a change in Flow can control all things that need to happen before a change of scene

    and, when user resets the scene …
    all the initial values are there without additional behaviors/rules

    image MH

Answers

  • 921creative921creative Member, PRO Posts: 140
    Thanks for the quick response @tshirtbooth. I'll try it and let you know how it works.
  • 921creative921creative Member, PRO Posts: 140
    @MotherHoose that's a great suggestion, which would be simple to carry out. I do have a lot of things that need to happen all at once and the game seems to get hung up sometimes trying to execute everything.

    @tshirtbooth I did add the game.CanMove attribute and that seemed to help. I still have a few other issues to work out before it's perfect but perhaps integrating the game.SceneFlow attribute will be the answer.

    Thanks both.
Sign In or Register to comment.