add the cake
This commit is contained in:
parent
72154b8c62
commit
7efba4bb64
1 changed files with 6 additions and 8 deletions
|
@ -47,8 +47,8 @@ Q.Sprite.extend("Player",{
|
||||||
// hit.sprite is called everytime the player collides with a sprite
|
// hit.sprite is called everytime the player collides with a sprite
|
||||||
this.on("hit.sprite",function(collision) {
|
this.on("hit.sprite",function(collision) {
|
||||||
|
|
||||||
// Check the collision, if it's the Tower, you win!
|
// Check the collision, if it's the cake, you win!
|
||||||
if(collision.obj.isA("Tower")) {
|
if(collision.obj.isA("Cake")) {
|
||||||
Q.stageScene("endGame",1, { label: "You Won!" });
|
Q.stageScene("endGame",1, { label: "You Won!" });
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
|
@ -59,11 +59,9 @@ Q.Sprite.extend("Player",{
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// ## Tower Sprite
|
Q.Sprite.extend("Cake", {
|
||||||
// Sprites can be simple, the Tower sprite just sets a custom sprite sheet
|
|
||||||
Q.Sprite.extend("Tower", {
|
|
||||||
init: function(p) {
|
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.Neingeist({ x: 700, y: 0 }));
|
||||||
stage.insert(new Q.Starbug({ x: 800, y: 0 }));
|
stage.insert(new Q.Starbug({ x: 800, y: 0 }));
|
||||||
|
|
||||||
// Finally add in the tower goal
|
// Finally add the cake
|
||||||
stage.insert(new Q.Tower({ x: 180, y: 50 }));
|
stage.insert(new Q.Cake({ x: 180, y: 50 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
// To display a game over / game won popup box,
|
// To display a game over / game won popup box,
|
||||||
|
|
Reference in a new issue