Moving an object with Tilt.
![swalker](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
I know this question has been asked before but I am still struggling, is there a simple (noob friendly) step by step system that I can get an Actor to respond to me tilting the device left, right, back or forward? I just need it to move in response to these movements.
Thanks.
Thanks.
Best Answer
-
MarkOnTheIron Posts: 1,447
Here's a fast one for you:
http://dl.dropbox.com/u/8244920/AccelerometerSimple.zip
By the way the file you posted on Sendspace won't open
Answers
-If device.accelerometer.X is < than -0.05
--accelerate/move direction 180
-If device.accelerometer.X is > than 0.05
--accelerate/move direction 0
-If device.accelerometer.X is < than -0.05
--accelerate/move direction 270
-If device.accelerometer.X is > than 0.05
--accelerate/move direction 90
Or something like this. Play with numbers and try for yourself.
Make sure your Actor is colliding with the walls. Add a collide attribute to the Actor (do not create a rule). Also make sure you have walls just outside of the viewable play area so that when your Actor collides with the walls, it stays in screen. You also need to make the walls not movable and check fixed rotation.
Hope that works for you!
many thanks :-)
Make sure the friction is set to 0 on the Actor and walls...
anyways, here's the project if you feel like glancing over it and seeing if anything obvious is leaping out: http://www.sendspace.com/file/4k39n3
thanks tonnes for your help britto! really appreciate this :-)
Great, I'll take a look at it. I'm still fairly new to GS, but I'll see what I can do. Give me a little bit to get back to you on it. I won't be in front of GS for a while. But, tell me quick what you want it to do exactly...
@swalker Glad @MarkOnThelron could help! Nice ^:)^