|
|
@ -49,8 +49,9 @@ Q.Sprite.extend("Player",{
|
|
|
|
|
|
|
|
|
|
|
|
// Check the collision, if it's the cake, you win!
|
|
|
|
// Check the collision, if it's the cake, you win!
|
|
|
|
if(collision.obj.isA("Cake")) {
|
|
|
|
if(collision.obj.isA("Cake")) {
|
|
|
|
Q.stageScene("endGame",1, { label: "You Won!" });
|
|
|
|
|
|
|
|
this.destroy();
|
|
|
|
this.destroy();
|
|
|
|
|
|
|
|
$( "#einladung" ).show( "slow" );
|
|
|
|
|
|
|
|
Q.stageScene("ThereWillBeCake",1, { label: "You Won!" });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -182,6 +183,29 @@ Q.scene('endGame',function(stage) {
|
|
|
|
container.fit(16);
|
|
|
|
container.fit(16);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q.scene('ThereWillBeCake',function(stage) {
|
|
|
|
|
|
|
|
var container = stage.insert(new Q.UI.Container({
|
|
|
|
|
|
|
|
x: Q.width/2, y: Q.height/2, fill: "rgba(0,0,0,0.5)"
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var button = container.insert(new Q.UI.Button({ x: 0, y: 0, fill: "#CCCCCC",
|
|
|
|
|
|
|
|
label: "Play Again" }));
|
|
|
|
|
|
|
|
var label = container.insert(new Q.UI.Text({x:10, y: -10 - button.p.h,
|
|
|
|
|
|
|
|
label: stage.options.label }));
|
|
|
|
|
|
|
|
// When the button is clicked, clear all the stages
|
|
|
|
|
|
|
|
// and restart the game.
|
|
|
|
|
|
|
|
button.on("click",function() {
|
|
|
|
|
|
|
|
$( "#einladung" ).hide();
|
|
|
|
|
|
|
|
Q.clearStages();
|
|
|
|
|
|
|
|
Q.stageScene('level1');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Expand the container to visibly fit its contents
|
|
|
|
|
|
|
|
// (with a padding)
|
|
|
|
|
|
|
|
container.fit(16);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// ## Asset Loading and Game Launch
|
|
|
|
// ## Asset Loading and Game Launch
|
|
|
|
// Q.load can be called at any time to load additional assets
|
|
|
|
// Q.load can be called at any time to load additional assets
|
|
|
|
// assets that are already loaded will be skipped
|
|
|
|
// assets that are already loaded will be skipped
|
|
|
|