How to keep actor within scene on Y axis

Hello! Is there a way to keep the actor from going out of the scene on the Y axis! The game is up and down and if I keep pressing the "touch" function the actor will keep going up till its out of the scene. I want it to hit the top and come right back down (Im using iphone landscape 480 width by 380 height I believe.)

Thank you , Victor (Im also very new to gamesalad) :)

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Sounds like another flappy?

    As always there are a number of ways you can do this.

    a) put an actor with a collide (with main actor) rule at the top of the scene. Give it a high bouncyness to let the main actor bounce back from the top.

    b) make a rule in the main actor. If self.position.y > your scene height then either stop its motion by self.motion.linear velocity.y = 0, or some some negative number to make it go down.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @hopscotch i went with the first one and it works! but how do you make it stay in place when it hits it? Cause when my actor hits its the bar ontop it flys away

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited March 2014

    Well, at the top you said it should "come right back down". :)

    If you always want it to stop when it hits the top then I suggest option b.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Hopscotch‌ thanks so much ! it worked fine!

  • HopscotchHopscotch Member, PRO Posts: 2,782

    My pleasure :)

Sign In or Register to comment.