I’m designing a moving ball game for Android. I’m using the thread for the movement of the ball around the screen. When I do the OnTouchEvent I’m able to obtain the X & Y coordinates of the screen wherever I tapped. My question here is how to obtain the values of X and Y coordinates of the ball for the same instance of the OnTouchEvent?
Share
Easy way is storing it’s coordinates in every moment(for example in two fields) and use them,when user tapped.Or you can create a class for example Ball which it has fields that store coordinates of current instance ball and getter and setter for coordinates.