I have the following code in my sketch to detect swiping movement on the screen so I can move the game character accordingly:
if(mousePressed){
if(mouseXPrevious != -1) {
xSpeed = mouseX - mouseXPrevious;
}
mouseXPrevious = mouseX;
}
else if(mouseXPrevious != -1){
xSpeed = 0;
mouseXPrevious = -1;
}
The code works and runs just fine on my Moto X Play (android 6.0.1), but when I tested the game on my old HTC One X (running android 4.2.2) it seemed that only half of the presses go through. When it did go through though, the character kept moving along with my finger as long as I held my finger on the screen. On the next touch, again nothing. On another try: It works again.
I've never ran into this problem on my main phone(the Motorola). What could be causing this?