50 lines
913 B
JavaScript
Executable file
50 lines
913 B
JavaScript
Executable file
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' );
|
|
ig.input.bind( ig.KEY.LEFT_ARROW, 'left' );
|
|
ig.input.bind( ig.KEY.RIGHT_ARROW, 'right' );
|
|
|
|
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 );
|
|
|
|
});
|