From 24ca06af50c144f8694fd84cdef3439666d2a5e9 Mon Sep 17 00:00:00 2001
From: Guillaume DE LA RUE <delarueguillaume@gmail.com>
Date: Sun, 13 Feb 2011 13:52:18 +0100
Subject: [PATCH] Bug fix for iOS support (tested on iPad 17FPS and iPhone 3GS
 29FPS)

---
 index.html                |  4 ++--
 js/GameClass.js           | 18 ++++++++++--------
 js/layouts/LayoutClass.js |  4 ++--
 js/main.js                |  7 ++++---
 4 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/index.html b/index.html
index 778f584..147230d 100644
--- a/index.html
+++ b/index.html
@@ -22,7 +22,7 @@
 	<!-- Stylesheets -->
 	<link rel="stylesheet" media="all" href="css/style.css" />
 	<link  href="http://fonts.googleapis.com/css?family=Orbitron:400,500,700,900" rel="stylesheet" type="text/css" >
-</head>
+</head> 
 <body>
 
 	<!-- Game Intro -->
@@ -71,7 +71,7 @@
 	<!-- The footer... -->
 	<footer id="credits" class="">
 		<strong>HTML5 Game Jam 2011</strong><br>
-		<strong><a href="https://github.com/glenux/wyrian" target="_blank" title="View Project on GitHub" class="game">..:: Wyrian v<span id="version">0.2a</span> ::..</a></strong> | <a href="http://www.html5place.com/" title="View my Website" class="author">Guillaume DE LA RUE</a><br>Thanks to <a href="https://github.com/glenux" target="_blank" title="View profile of Glenux on GitHub" class="quote">Glenux</a> for design and Matthieu Bosquet<br>And everyone present at the HTML5 Game Jam :)
+		<strong><a href="https://github.com/glenux/wyrian" target="_blank" title="View Project on GitHub" class="game">..:: Wyrian v<span id="version">0.2b</span> ::..</a></strong> | <a href="http://www.html5place.com/" title="View my Website" class="author">Guillaume DE LA RUE</a><br>Thanks to <a href="https://github.com/glenux" target="_blank" title="View profile of Glenux on GitHub" class="quote">Glenux</a> for design and Matthieu Bosquet<br>And everyone present at the HTML5 Game Jam :)
 	</footer>
 	
 	<!-- Main JS Libs -->
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 = $('<div>', {
-				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/",