JSGameLib
JSGameLib is a jQuery Plugin that adds 'game' functionality to jQuery. Simple things like collision detection, keyboard movement (WASD, Arrows, Etc).
Currently, it is in an extremely early state and only supports a basic amount of stuff, however it will eventually be able to do quite a bit more, such as create 'patterned movement' for 'flying objects' as well as add a few extra 'events' such as 'off screen', etc.
Collision detection is currently handled by setting a manual interval, or polling for the detection when you want to know ... and passing in a function handler if collision is true. You can check collision against a number of objects, any valid jQuery Selector to be exact:
-
$('.badguys').collision('.goodguys', function(bad,good) {
-
bad.remove();
-
good.score(-100); // subtract 100 from the score, and remove the bad guy who collided with the good guy
-
});
In this example, we pass 'bad' and 'good' to the 'true' handler, and the handler is called once for each 'bad' element that collides with a 'good' element ... and the two elements in question are passed in.
An example of the collision detection and keyboard movement can be seen here:


