How would I get it so that when the iPhone is leaned right or left, an object moves to pixels with it.
[import]uid: 39533 topic_id: 17081 reply_id: 317081[/import]
Did you have a look at the sample code template for the accelerometer? It’s very helpful.
http://developer.anscamobile.com/content/accelerometer-1
-David [import]uid: 96411 topic_id: 17081 reply_id: 64147[/import]
I have looked at it extensively, but It wont seem to work.
local centerX = 320/ 2
local centerY = 480/2
raft = display.newImage(“RUSHraft.png”)
raft.x= centerX
raft.y = centerY
raftControls = function (event)
raft.x = centerX + (centerX * event.xGravity)
end
This is what I have. [import]uid: 39533 topic_id: 17081 reply_id: 64199[/import]
Try this - just removed the Y references if you’re only wanting to move it on X.
http://techority.com/2010/11/19/control-an-actor-with-the-accelerometer/
Peach [import]uid: 52491 topic_id: 17081 reply_id: 64212[/import]