Game Development Community

Detect shake

by MusiX · in iTorque 2D · 08/24/2009 (4:17 am) · 2 replies

Hi,

I'm working on a simple game, my first one using iTGB. Now i like to be able to detect shakes but I have no idea how to do it. I know that the joystick is used for detecting accelerometer, but I've no idea how to detect a shake.

Thanks in advance

#1
08/24/2009 (8:10 am)
The backwards compatible way:

Detect changes in different directions. Count how many changes happen, and determine a threshold in (hundreds of ?) milliseconds and number of changes before it counts as a shake.

The code to do that is your homework assignment for tomorrow :P

OS 3.0 has a simple way to detect shakes, but more than half the iPod touch users haven't upgraded (CAVEMEN!), as opposed to nearly every iPhone user (except those who can't get a signal to know about the update, possibly for living in caves).
#2
08/24/2009 (11:00 am)
dude .. . cavemen have feelings, too. their feelings have already been hurt by geico, don't add to it