papyhardcore

main.js

Feb 10th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ig.module(
  2.     'game.main'
  3. )
  4. .requires(
  5.     'impact.game',
  6.     'impact.font',
  7.         'game.entities.Player'
  8. )
  9. .defines(function(){
  10.  
  11. MyGame = ig.Game.extend({
  12.    
  13.     // Load a font
  14.     font: new ig.Font( 'media/04b03.font.png' ),
  15.    
  16.    
  17.     init: function() {
  18.         // Initialize your game here; bind keys etc.
  19.                 ig.input.bind(ig.KEY.UP_ARROW,'up');
  20.                 ig.input.bind(ig.KEY.DOWN_ARROW,'down');
  21.                 ig.input.bind(ig.KEY.LEFT_ARROW,'left');
  22.                 ig.input.bind(ig.KEY.RIGHT_ARROW,'right');
  23.                 ig.input.bind(ig.KEY.A,'fire');
  24.                 ig.input.bind(ig.KEY.B,'bomb');
  25.     },
  26.    
  27.     update: function() {
  28.         // Update all entities and backgroundMaps
  29.         this.parent();
  30.        
  31.         // Add your own, additional update code here
  32.     },
  33.    
  34.     draw: function() {
  35.         // Draw all entities and backgroundMaps
  36.         this.parent();
  37.        
  38.        
  39.         // Add your own drawing code here
  40.        
  41.     }
  42. });
  43.  
  44.  
  45. // Start the Game with 60fps, a resolution of 320x240, scaled
  46. // up by a factor of 2
  47. ig.main( '#canvas', MyGame, 60, 640, 480, 1 );
  48.  
  49. });
Advertisement
Add Comment
Please, Sign In to add comment