neingeist
/
cosmos
Archived
1
0
Fork 0

add the cake

master
neingeist 11 years ago
parent 72154b8c62
commit 7efba4bb64

@ -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,