Returning dragged actor back to original position

KajzaKajza Member Posts: 1
edited March 2014 in Working with GS (Mac)

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

  • AlkaPPAlkaPP Member, PRO Posts: 194
    edited March 2014

    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

  • KajzaKajza Member Posts: 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?

  • AlkaPPAlkaPP Member, PRO Posts: 194

    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

Sign In or Register to comment.