From 7efba4bb64104bdc966bcb3508ca3a9f3e22f4bf Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 24 Nov 2013 21:13:45 +0100 Subject: [PATCH] add the cake --- platformer.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/platformer.js b/platformer.js index 2fcd7ed..c6f4783 100644 --- a/platformer.js +++ b/platformer.js @@ -47,8 +47,8 @@ Q.Sprite.extend("Player",{ // hit.sprite is called everytime the player collides with a sprite this.on("hit.sprite",function(collision) { - // Check the collision, if it's the Tower, you win! - if(collision.obj.isA("Tower")) { + // Check the collision, if it's the cake, you win! + if(collision.obj.isA("Cake")) { Q.stageScene("endGame",1, { label: "You Won!" }); this.destroy(); } @@ -59,11 +59,9 @@ Q.Sprite.extend("Player",{ }); -// ## Tower Sprite -// Sprites can be simple, the Tower sprite just sets a custom sprite sheet -Q.Sprite.extend("Tower", { +Q.Sprite.extend("Cake", { init: function(p) { - this._super(p, { sheet: 'tower' }); + this._super(p, { sheet: 'minecraft-cake' }); } }); @@ -153,8 +151,8 @@ Q.scene("level1",function(stage) { stage.insert(new Q.Neingeist({ x: 700, y: 0 })); stage.insert(new Q.Starbug({ x: 800, y: 0 })); - // Finally add in the tower goal - stage.insert(new Q.Tower({ x: 180, y: 50 })); + // Finally add the cake + stage.insert(new Q.Cake({ x: 180, y: 50 })); }); // To display a game over / game won popup box,