Time based items on a scene

So I am working on a game, and what I am trying to accomplish is, when my actor enters a scene and waits 30 seconds he is granted certain amounts of coins for entering that scene (room) is there a way to set this up? Or better yet, if he clicks on an item and waits he gets granted the certain amount if coins after 30 seconds, but he has to stay there, because if he moves I don't want him to get the coins, he needs to stay on that scene (room) for that many seconds if he exits it before he doesn't get the coins if he stays 30sec or more he gets the coins

Is this possible to do?

Comments

  • DaGreatnessDaGreatness Member Posts: 82
    @sadida172 thanks for the response!!! So let me see if I got this:

    (This is the item that is being pressed or actor button whatever)

    If touch is pressed
    Do
    Save x.position to attribute of player (which is a real attribute labeled oldX)

    Set timer after 30 seconds

    Are these 2 rules?

    Where is this rule setup? Still on that same certain item? Or somewhere else?

    If self.position.x = self.oldX
    Change attribute game.coins to game.coins +15


    Will this only give the coins after 30 seconds if the person stayed there or will this give it after 30 seconds once they touched it and leave? Because I need them to stay once they click

    I just trying to clear up the air before I try it.

    Thanks in advance
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @DaGreatness Here's a demo. Arrow keys to move side to side. Click on the green "item" and wait 5 seconds (game.timeToWait) without moving to receive coins. If you move, you'll see the message "failed" on the player actor.

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

  • DaGreatnessDaGreatness Member Posts: 82
    THANKS GUYS!!!
Sign In or Register to comment.