Help with only tapping one actor at a time

krewic gamingkrewic gaming Member, PRO Posts: 19

Hey gamesalad community,
so in the app im working on if the background is tapped then it will result in a gameover however if you tap the actors that are on top of the actor then you should be able to continue playing. instead it acts as if the background was tapped and gives you a game over. any advice?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    Make a boolean game attribute - let's call it DEATH !!!

    . . . . . . .

    In the foreground actor place a rule that says:

    When mouse position is 'outside'
    --Change DEATH to 1
    ---Otherwise
    ----Change DEATH to 0

    . . . . . . .

    In the background actor place a rule that says:

    When touch is pressed and attribute DEATH is true
    --Then place whatever happens when the player dies here.

    . . . . . . .

  • krewic gamingkrewic gaming Member, PRO Posts: 19

    @Socks hey thanks for replying Im sure that to get that to work for say an iphone game you could simply say if touch is outside right? Also Since I have five actors that are selected at random so how could I make it so that tapping any that are not currently selected also results in a game over

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    Are you trying to build a "find hidden objects" type game, or that same type of mechanic where you have to find certain objects from a multitude of objects on the screen, and it's game over if you select one that's not on the list? Is this what you mean by having 5 actors that are selected at random?

  • krewic gamingkrewic gaming Member, PRO Posts: 19

    @KevinCross The game I am making selects one of five actors at random and you have to tap that actor without touching the other actors or the background to avoid a gameover.

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited June 2015

    I can't build you a template as I'm at work but this may help point you in the right direction

    Have one hidden actor on the scene that has this:
    Change Attribute: game.objectToTap = random(1,5)

    On each of the 5 actors that need to be tapped add a attribute called: objectNo, and set them each as 1 to 5

    On these actors add 2 rules:
    If touch is pressed and self.objectNo != game.objectToTap
    ... GAME OVER (do what you need to do activate game over and pick a new game.objectToTap number with random(1,5)
    If touch is pressed and self.objectNo = game.objectToTap
    ... SUCCESS (move on to the next level or whatnot)

    Have a background actor with this rule:
    If touch is pressed
    ... GAME OVER (do what you need to do activate game over and pick a new game.objectToTap number with random(1,5)

    I wouldn't add the GAME OVER code to both the "actors to tap" and the "background". I would instead set a game attribute like Socks example. I also wouldn't have an actor that initially picks the objectToTap randomly only once like I'm doing above. That would work best in a new game actor/set of rules.

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659

    You can't have the background being touched go to game over, it will always override everything else.
    Here is how I would do it.

    Kinda like Kevin said assign each object a number 1-5

    Make two attributes:

    Game.number_to_press

    Game.number_pressed

    In each actor make rule:

    If pressed

    change Game.number_pressed to (the number for that actor, either 1, 2...)

    Then have an actor that randomizes which one to be pressed

    change Game.number_to_press to Random(1,5)

    Then have a rule using touch count

    If device.touchcount = 1 AND Game.number_to_press doesn't equal Game.number_pressed

    Then Game Over

    The only foreseeable problem is if the rule for game over happens before the rule to change Game.number_pressed
    So you may need to play around with it but that logic should work

Sign In or Register to comment.