diff --git a/index.html b/index.html index 778f584..147230d 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ - + @@ -71,7 +71,7 @@ diff --git a/js/GameClass.js b/js/GameClass.js index 43e73fe..15f2f3a 100644 --- a/js/GameClass.js +++ b/js/GameClass.js @@ -28,7 +28,7 @@ var app = function(opts) { // Listen for inputs this.input = new this.Input() ; - + // Return object return this; } ; @@ -40,7 +40,7 @@ app.prototype.init = function() { require({ baseUrl: "js/", - urlArgs: "bust=" + self.version + urlArgs: "bust=" + GameVersion }, // -- Layout to load @@ -81,12 +81,14 @@ app.prototype.loopAnimation = function() { // -- Create ennemies if needed var numEnnemies = 0 ; - for ( var i in Layouts.Ennemies.els ) { - var _el = Layouts.Ennemies.els[i] ; - if ( ! _el.deleteAfter ) numEnnemies++ ; - } - for ( var i = numEnnemies-1 ; i < Level + 3 ; i++ ) { - Layouts.Ennemies.createRandom() ; + if ( Layouts.Ennemies ) { + for ( var i in Layouts.Ennemies.els ) { + var _el = Layouts.Ennemies.els[i] ; + if ( ! _el.deleteAfter ) numEnnemies++ ; + } + for ( var i = numEnnemies-1 ; i < Level + 3 ; i++ ) { + Layouts.Ennemies.createRandom() ; + } } // -- Init loops counter diff --git a/js/layouts/LayoutClass.js b/js/layouts/LayoutClass.js index 03cdf83..474718f 100644 --- a/js/layouts/LayoutClass.js +++ b/js/layouts/LayoutClass.js @@ -95,8 +95,8 @@ Layout.prototype.createObj = function(opts) { if ( ! this.box.length ) { this.box = $('
', { - class:'sprite '+this.name, - id: this.id + 'class':'sprite '+this.name, + 'id': this.id }) ; this.cssObj = { diff --git a/js/main.js b/js/main.js index 48117be..44aa891 100644 --- a/js/main.js +++ b/js/main.js @@ -5,7 +5,8 @@ var Game = new app({ 'order!layouts/Ennemies' ], 'wrapper': $('#GameContainer') -}) ; +}), +GameVersion = 0 ; // Init Application and bind all games events jQuery(document).ready(function() { @@ -13,11 +14,11 @@ jQuery(document).ready(function() { /************************************************************************** * Load Dependencies & Create Application ***************************************************************************/ + GameVersion = $('#version').html() ; var baseLibs = [ 'order!libs/jquery.transform-0.9.3.min', 'order!layouts/LayoutClass' - ], - GameVersion = $('#version').html() ; + ] ; require({ baseUrl: "js/",