Lose game when not touching actor

Hi, I'm making a really simple game in which you have to touch blocks and your finger will always be placed on the screen.
When you are touching one of the blocks, the game just keeps on. But when you are NOT touching a block, I need it to lose it.

So, to sum up, I need to detect if you have stopped touching a block. Or if a new one has been pressed, otherwise, you lose the game.

Thanks for your help, and sorry if my english is not too good.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    When mouse button is up
    .....Change scene

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ArmellineArmelline Member, PRO Posts: 5,370

    @tatiang said:
    When mouse button is up
    .....Change scene

    It may be stating the obvious, but also worth noting:

    Be sure to have it only trigger after the mouse button has been registered as down. Could be something as simple as adding a self attribute, e.g. self.pressed, that gets triggered when the button is pressed, and adding that as a condition to the button up rule.

    When actor receives event mouse button is down
    Change attribute self.pressed to true
    
    When actor receives event mouse button is up AND attribute self.pressed is true
    Change scene
    

    Or something like that. Otherwise the second rule will trigger the moment the scene starts.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Good point, @Armelline. Mouse is up only triggers after a mouse is down has occurred so if it was on the very first scene, my method would actually work but it's not too practical since if you had a scene before it with, say, a "Start" button and you click/tap it, then in the next scene the mouse is up will be registered immediately.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ArmellineArmelline Member, PRO Posts: 5,370
    edited March 2014

    In my testing just now, mouse down was not required for mouse up to trigger.

    I put an actor on the only scene in the project, added a mouse up rule and put a display text inside it. The display text triggered immediately with no interaction. Adding the extra rule as described above made it respond as expected.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @Armelline said:
    In my testing just now, mouse down was not required for mouse up to trigger.

    Hmm... if I add an actor with When Mouse is Up... Display Text, it doesn't display until I've clicked and released the mouse button. But regardless, your method is better! :)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ArmellineArmelline Member, PRO Posts: 5,370

    See my edit :D That's really weird :D

    There must be a difference somewhere in what we did :D

  • SantivinSantivin Member Posts: 25

    Thanks a lot!

  • SantivinSantivin Member Posts: 25

    Hey! Everything went fine, when I touch and release an actor it does what it has to do. However, if i place my finger outside the actor called "Bubble", nothing happens. I need the game to go to the next scene if that happens (game over), unless if a new actor is being pressed (the same type of actor as the one named before, another bubble)

  • SantivinSantivin Member Posts: 25

    anybody?

Sign In or Register to comment.