uberpong/dev/lib/game/main.js

47 lines
818 B
JavaScript
Raw Normal View History

ig.module(
'game.main'
)
.requires(
'impact.game',
'impact.font',
'game.entities.ball',
'game.entities.paddle-enemy',
'game.entities.paddle-player',
'game.levels.level1'
)
.defines(function(){
MyGame = ig.Game.extend({
// Load a font
font: new ig.Font( 'media/04b03.font.png' ),
init: function() {
ig.input.bind( ig.KEY.UP_ARROW, 'up' );
ig.input.bind( ig.KEY.DOWN_ARROW, 'down' );
this.loadLevel( LevelLevel1 );
},
update: function() {
// Update all entities and backgroundMaps
this.parent();
// Add your own, additional update code here
},
draw: function() {
// Draw all entities and backgroundMaps
this.parent();
}
});
// Start the Game with 60fps, a resolution of 640x400 (16:10), scaled
// up by a factor of 2
ig.main( '#canvas', MyGame, 60, 640, 400, 1 );
});