Moving a Ball on iPhone
Posted
by Chandan Shetty SP
on Stack Overflow
See other posts from Stack Overflow
or by Chandan Shetty SP
Published on 2010-03-24T05:46:39Z
Indexed on
2010/03/24
5:53 UTC
Read the original article
Hit count: 267
I am using below formula to move the ball circular, where accelX and accelY are the values from accelerometer, it is working fine. But the problem in this code is mRadius(I fixed its value to 50), i need to change mRadius according to accelerometer values and also i need bouncing effect when it touches other circles please send your answers ASAP... I am waiting.
float degrees = -atan2(accelX, accelY) * 180 / 3.14159; int x = cCentrePoint.x + mRadius * cos(degreesToRadians(degrees)); int y = cCentrePoint.y + mRadius * sin(degreesToRadians(degrees));
Here is the snap of the game i want to develop. http://iphront.com/wp-content/uploads/2009/12/bdece528ea334033.jpg.jpg
© Stack Overflow or respective owner