How to keep actor within scene on Y axis
http_gamesalad
Member Posts: 1,340
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
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.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@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
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.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch thanks so much ! it worked fine!
My pleasure
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com