I am creating a basic game that uses the accelerator to move a ball. When you tilt the iPhone the ball moves to the left or right depending on which way you tilted the device. I placed an image that was static so when the ball hit the bar (image) it would bounce back but instead the ball goes right through the bar (image) with some resistance. What can I can do to make the ball not go through the bar(image)?
[code]–Accelerometer
local motionx = 0
local motiony = 0
local function onAccelerate( event )
motionx = 30 * event.yGravity
motiony = 1 * event.xGravity
end
Runtime:addEventListener (“accelerometer”, onAccelerate)
local function moveball (event)
circle.x = circle.x - motionx
circle.y = circle.y - motioy
end
Runtime:addEventListener(“enterFrame”, moveball)
[/code] [import]uid: 82872 topic_id: 19606 reply_id: 319606[/import]