Make and actor move up or down Or Left and right
maca
Member Posts: 4
Can anyone point me in the direction of a tutorial that shows my students how to make an actor (in this case a surfer) move up and down by touching and dragging on the screen. In this instance the actor is off to the right hand side of the screen and the touch area is on the left. He doesn't want any buttons or arrows on the screen. I had a student ask something similar in a game where they wanted to drag a Moustache left and right but only touching below the screen. Ive seen some very good tutorials on actually dragging an object but this involves touching the actual actor and dragging it.
thanks
thanks
Comments
Add a game attribute called TouchY.
On the invisible actor added above add a rule like this:
If touch is inside
Constrain Attribute: TouchY = game.Mouse.Position.Y
On your surfer actor add this:
Constrain Attribute: self.Position.Y = game.TouchY
That will give you an up and down trackpad at the left of the screen.
You can do a similar thing with a left and right trackpad at the bottom of the screen for moving a moustache, but with the Mouse.Position.X value
Let me know if anything is incorrect above