diff --git a/index.html b/index.html index 31f9e78..f940797 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,8 @@ genossen! am 30.11. laden neingeist und starbug ein zu einem cosmonautischen fest! + + + + + diff --git a/platformer.js b/platformer.js index d12faf1..0030c81 100644 --- a/platformer.js +++ b/platformer.js @@ -49,8 +49,9 @@ Q.Sprite.extend("Player",{ // Check the collision, if it's the cake, you win! if(collision.obj.isA("Cake")) { - Q.stageScene("endGame",1, { label: "You Won!" }); this.destroy(); + $( "#einladung" ).show( "slow" ); + Q.stageScene("ThereWillBeCake",1, { label: "You Won!" }); } }); @@ -182,6 +183,29 @@ Q.scene('endGame',function(stage) { 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 // Q.load can be called at any time to load additional assets // assets that are already loaded will be skipped