Returning dragged actor back to original position
Kajza
Member Posts: 1
I'm making my first game on Gamesalad. I can drag my actor around the scene. But when users releases touch, the actor should return to its original position. How do I achieve this? I just can't figure out rule to make this happen.
Edit. Also, I would like to get the movement constrained just up and down movement, not left to right.
Comments
Try this:
Rule 1: When touch is pressed
Constrain Attribute: self.position.y = game.touches.touch1.y (game is Devices, don't get confuse with the Game above it) This will allow you to drag on the y axis (up and down only).
Rule 2: When touch is Release
Constrain Attribute: self.position.y = (your y position # where you want it to return to)
Hope this helps,
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1
Got the return and the Y axel movement only working Now I just have to figure out how to constrain the actor so that the user can only drag it until a certain point. Any hints?
You can either use invisible actors and set the drag actor collide with it so it will be only in your limited area. The other way is to set up some integer attribute and set it to be the max value of your drag actor. Then create a rule to control it, but this will take a little extra work. I'm working on a project and won't be able to provide you a detailed instruction. I can help you later or someone else will help you with it.
My Gamesalad Games On App Store:
Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1