this example shows a game loop managed with iFsm, with bouncing balls and a racket as objects using canvas (jCanvas) with layers to display them and with behaviours handled by iFSM (bouncing), using requestAnimationFrame calls instead of setTimeout
The mouse or finger touch move the racket
The game ends when you have touched 10 times the ground
The score is then displayed using the number of frames to give the score...