Im trying to make make game which is intended to be played with the phone in landscape mode, and the player uses their thumbs to control the movement. The game controls look like this:
On the left there is a simple button to accelerate, and on the right a wheel to adjust the direction. Both work perfectly when used individually but they won't work both at the same time.
I would need to implement multitouch and accelerate/rotate depending on which side of the screen the finger is on, but I can't figure out how to do that detection.
Below is the onTouchEvent, how can i modify it to do what i want?
@Override
public boolean onTouchEvent(MotionEvent event){
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (event.getX() < 300 && event.getY() > 250) {
btnPress = true;
}
break;
case MotionEvent.ACTION_MOVE:
x = (int) event.getX(); //this is used by the direction wheel
y = (int) event.getY();
break;
case MotionEvent.ACTION_UP:
btnPress = false;
break;
}
return true;
}