HTML and CSS Reference
In-Depth Information
An example of a lightbox in the game. ( Large image 6
This kind of functionality doesn't exist in a regular JavaScript game engine. You could always
improve an existing framework with your own code, but diving into someone else's code
sometimes takes longer than writing your own. Moreover, if you rewrite someone else's code,
it could become a problem when a new version is released.
After passing over libraries such as Crafty , LimeJS and Impact , which really are great game
7
8
9
engine frameworks, I felt I had no choice but to build my own engine to fit my needs.
Let's quickly review the main methods that I'm running in the game.
To handle the keyboard arrow events, I use the following code:
$ ( window ). unbind ( 'keydown' ). bind ( 'keydown' , function ( event ) {
switch ( event . keyCode ) {
event . preventDefault ();
case 37 : // Move
Left
me . moveX ( me . leftPos - 5 , 'left' );
break ;
 
 
 
Search WWH ::




Custom Search