display text when player wins
This commit is contained in:
		
							parent
							
								
									e8ef7f7594
								
							
						
					
					
						commit
						fb7811038c
					
				
					 2 changed files with 40 additions and 1 deletions
				
			
		
							
								
								
									
										15
									
								
								index.html
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								index.html
									
										
									
									
									
								
							|  | @ -7,6 +7,8 @@ | ||||||
|   <title>genossen! am 30.11. laden neingeist und starbug ein zu einem cosmonautischen fest!</title> |   <title>genossen! am 30.11. laden neingeist und starbug ein zu einem cosmonautischen fest!</title> | ||||||
| 
 | 
 | ||||||
|   <script src='http://cdn.html5quintus.com/v0.1.5/quintus-all.js'></script> |   <script src='http://cdn.html5quintus.com/v0.1.5/quintus-all.js'></script> | ||||||
|  |   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | ||||||
|  | 
 | ||||||
|   <script src='platformer.js'></script> |   <script src='platformer.js'></script> | ||||||
| 
 | 
 | ||||||
|   <style> |   <style> | ||||||
|  | @ -14,5 +16,18 @@ | ||||||
|   </style> |   </style> | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|  | 
 | ||||||
|  | <div style="display: none" id="einladung"> | ||||||
|  | Fo shizzle boofron dolor sit amizzle, consectetuer my shizz elit. Nullam go to | ||||||
|  | hizzle velit, daahng dawg volutpizzle, suscipit , gravida vel, i saw beyonces | ||||||
|  | tizzles and my pizzle went crizzle. Pellentesque eget tortizzle. Sizzle eros. | ||||||
|  | Shizznit izzle dolizzle dapibus fizzle black crazy. Maurizzle pellentesque uhuh | ||||||
|  | ... yih! et fizzle. Shizzle my nizzle crocodizzle izzle tortor. Mofo things | ||||||
|  | rhoncizzle sizzle. In ghetto gangsta shut the shizzle up gangsta. I saw beyonces | ||||||
|  | tizzles and my pizzle went crizzle dapibus. Curabitur tellus hizzle, pretizzle | ||||||
|  | eu, mattizzle break it down, eleifend break it down, nunc. Doggy crazy. | ||||||
|  | Integizzle cool bizzle sizzle bow wow wow. | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
|  | @ -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
 | ||||||
|  |  | ||||||
		Reference in a new issue