Commits

Anonymous committed 1ee68f0

working gameover and congrats

Comments (0)

Files changed (3)

 		
 		public static var levelArr:Array = [
 			Level0,
-			Fan, // most easy
-			Hole,
-			Hexagon,
-			Bounce,
-			VStripe,
-			Xlash,
-			CornerFan,
-			Stripe,
-			Grid,
+//			Fan, // most easy
+//			Hole,
+//			Hexagon,
+//			Bounce,
+//			VStripe,
+//			Xlash,
+//			CornerFan,
+//			Stripe,
+//			Grid,
 		];
 		
 		
 						_levellength = _curolist.length;
 //						trace(_curwave);
 					} else {
-						if (_levelix++ < Au.levelArr.length) {
+						if (++	_levelix < Au.levelArr.length) {
 							switchLevel(new (Au.levelArr[_levelix]));
 						} else {
 							// game is done!
-							FP.world = new MenuWorld();
+//							FP.world = new MenuWorld();
+							showPanel(1, true); // dirty dummy heart
+							gameover();
+							return; // to bypass switchPhase
 						}
 					}
 					switchPhase(INDI_PHASE);
 				}
+			} else if (_phase == GAME_OVER) {
+				// fuck do nothing
 			}
 			
 			// debugs
-			if (Input.pressed(Key.R)) {
-				FP.world = new GameWorld();
-			}
-			if (Input.pressed(Key.J)) {
-				FP.camera.x -= 5;
-			}
-			if (Input.pressed(Key.L)) {
-				FP.camera.x += 5;
-			}
-			if (Input.pressed(Key.I)) {
-				FP.camera.y -= 5;
-			}
-			if (Input.pressed(Key.K)) {
-				FP.camera.y += 5;
-			}
+//			if (Input.pressed(Key.R)) {
+//				FP.world = new GameWorld();
+//			}
+//			if (Input.pressed(Key.J)) {
+//				FP.camera.x -= 5;
+//			}
+//			if (Input.pressed(Key.L)) {
+//				FP.camera.x += 5;
+//			}
+//			if (Input.pressed(Key.I)) {
+//				FP.camera.y -= 5;
+//			}
+//			if (Input.pressed(Key.K)) {
+//				FP.camera.y += 5;
+//			}
 			
 			// essential updates
 			updateQuake();
 			} else {
 				_panel.show(7 - Hearts, Hearts == 0 ? true: false);
 			}
+			if (Hearts == 0) gameover();
+		}
+		
+		private function gameover():void
+		{
+			_phase = GAME_OVER;
+			player.kill();
 		}
 	}
 }
 			// collide when active
 			if (_player.active && collideWithEx(_player)) { 
 				// TODO die/hurt here
-				FP.console.log(Au._cnter++);
+//				FP.console.log(Au._cnter++);
 				_player.kill();
 				GameWorld.gworld.quake(15);
 				GameWorld.gworld.showPanel(7 - _player.deathcount);