Example: Player has knife, [shakes phone] and switches to a katana.
if (accelerometer.x >= 5 || accelerometer.x <= -5 || accelerometer.y >= 5 || accelerometer.y <= -5 || accelerometer.z >= 5 || accelerometer.z <= -5 ) switchWep();
This works, the problem is it has a side effect.When the player shakes the phone sometimes it switches weapons twice. So I want to limit it so that if there is a big shake the game doesn't switch from weapon 0 to weapon 2.
Please help.






