From 41dadb629fd47a5f806175b825d9b1a0eeffde69 Mon Sep 17 00:00:00 2001 From: Fabrice Ecaille Date: Thu, 17 Oct 2013 17:31:22 +0200 Subject: [PATCH] Bugfix: live management --- js/spaceinvaders-core.js | 4 +--- js/spaceinvaders-ui.js | 12 +++--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/js/spaceinvaders-core.js b/js/spaceinvaders-core.js index ebe548c..daa4108 100644 --- a/js/spaceinvaders-core.js +++ b/js/spaceinvaders-core.js @@ -77,13 +77,12 @@ Game = { if( !Game.running ) { return false; } - + var health = Game.ship.hit(); $(".alienShot").remove(); $(".shipShot").remove(); $("#life" + Game.ship.lives).remove(); Game.running = false; - Game.ship.lives = Game.ship.lives - 1; $("#hero").children().hide(); if( Game.ship.lives > 0 ) { @@ -120,7 +119,6 @@ Game = { }, setShip : function() { - var type = SHIPS.scout; Game.ship = new Ship("ship", { x : $("#hero").x(), y : $("#hero").y() diff --git a/js/spaceinvaders-ui.js b/js/spaceinvaders-ui.js index dc0f19a..9b387a8 100644 --- a/js/spaceinvaders-ui.js +++ b/js/spaceinvaders-ui.js @@ -24,12 +24,6 @@ var PLAYGROUND_WIDTH = 448, START_Y = 40; -var SHIPS = { - scout: {width: 30, height: 25}, - bomber: {width: 30, height: 25}, - cruser: {width: 30, height: 25} -}; - var animations = WORLD.farm; function displayModal(data) { @@ -137,9 +131,9 @@ $(function(){ width: 100, height: 32 }) - .addSprite("life3", animations.life) - .addSprite("life2", $.extend({posx: 32}, animations.life)) - .addSprite("life1", $.extend({posx: 64}, animations.life)) + .addSprite("life2", animations.life) + .addSprite("life1", $.extend({posx: 32}, animations.life)) + .addSprite("life0", $.extend({posx: 64}, animations.life)) .end() .addGroup("levelGrp", { posx: PLAYGROUND_WIDTH - (6 * 32 + 16),