I have a ball in screen , the ball moves via accelerometer sensor. I want shows another ball in screen, that first ball chasing and following second ball and second ball escape of first ball. I searched on the internet but i can't find any link or tutorial, maybee i don't use correct sentence for search, anyway. Please help me with link or advise. Thanks.
Then when you have a ball that moves around smoothly you can create the other ball - the logic of the other ball which the user chases.
Thanks for quick reply. I know about how can move a ball with Accelerometer and i implemented this! but i don't know how can implemented this with two ball! When first ball approached to second ball, i want second ball escape of first ball and go to another place . Please help me to implement this Thanks
In that case, the first thing to do is have the running ball be notified of the location of the first ball. The chaser ball keeps track of its location and publishes its position to listeners (for example). The escaping ball keeps track of its own location and is a listener to the chaser's position. When the escaping ball determines the chaser is too close it moves.
There is decisions on how it moves: how far away does the chaser have to be to move? How far/fast/long is it allowed to move? How does it choose a course to move in (i.e. you have to avoid obstacles, such as the chaser ball)? Does it have a destination? Does it move randomly or towards that destination? Those are all application - specific stuff you will have to work out, but the basic strategy is the chaser is independent and controlled by the phone's motion, while the escaper is a.i. that reacts to the chaser (and whatever other stimuli you provide it). So what you need to do is feed the escaper the coordinates of the chaser so it can react.