Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Mikie on April 24, 2012, 05:56:36 PM

Title: Object on Android
Post by: Mikie on April 24, 2012, 05:56:36 PM
I would like to touch an object on my android and be able to move the object with my finger.  Can this be a done?
Title: Re: Object on Android
Post by: justifun on April 26, 2012, 02:56:11 PM
sure can

Just use the "touch object event" action to check when the object first gets "touched"
https://hutonggames.fogbugz.com/default.asp?W680

then have it transition to a state that constantly updates the position (set position) of your finger location (which you will get from the "get touch info" action
https://hutonggames.fogbugz.com/default.asp?W579

so state 2 would have
Get touch info (save the x and Y value into a variable)
and "set position" (using the saved x and Y variable data)

Make sure your camera is set to view your game from the side, because Y is up (if you are looking from a top down view the get touch info would be looking at the wrong axises)

You could also add another get touch info action to state 2 and have it do something else once you let go of your finger too if you want.