public MainMenu() { _background = ResourceManager.tex_background_level1; _hc = new HandCursors(); _aventureBtn = new TextButton("The Epic Quest of Squick", new Rectangle(50, 50, 600, 100)); _level1Btn = new TextButton("Level 1", new Rectangle(50, 200, 200, 100)); _level2Btn = new TextButton("Level 2", new Rectangle(50, 350, 200, 100)); _quitBtn = new TextButton("Quit", new Rectangle(500, 450, 150, 100)); }
public VictoryMenu() { _background = ResourceManager.tex_background_level1; _hc = new HandCursors(); _victoryMsg = new TextBox("Thanks for playing", new Rectangle(100, 50, 600, 100)); if (ScoreHolder.hasLevel1) _level1Box = new TextBox("Level 1 : " + ScoreHolder.Level1.ToString("000000"), new Rectangle(350, 200, 350, 50)); if (ScoreHolder.hasLevel2) _level2Box = new TextBox("Level 2 : " + ScoreHolder.Level2.ToString("000000"), new Rectangle(350, 275, 350, 50)); if (ScoreHolder.hasLevel1 && ScoreHolder.hasLevel2) _levelTotal = new TextBox("Total : " + ScoreHolder.Total.ToString("000000"), new Rectangle(350, 350, 350, 50)); _backToMenuBtn = new TextButton("Back to Menu", new Rectangle(100, 200, 200, 100)); _quitBtn = new TextButton("Quit", new Rectangle(500, 450, 150, 100)); }
public Level2(KinectInterface gameInput) { _levelBackground = ResourceManager.tex_background_level2; squick = new JumpingSquick(gameInput); squick.Pos = new Vector2(400, 800); squick.Speed = new Vector2(0,-600); toBeDestroy = new List<Entity>(); activeBranch = new Branch(gameInput); oldBranches = new List<Branch>(); cameraOffset = 0; fadeEffect = new Fade(); gauge = new Gauge(new Rectangle(30, 50, 10, 500), goal, Color.BurlyWood, Color.Gold); message = new Message("Training time !", new Vector2(20, 220), 2.0f, Message.DISPLAY_LBL, 50); hc = new HandCursors(); }
public override void Update(GameTime gameTime, KinectInterface gameInput) { // Update buttons state _hc = new HandCursors(); _gameOverMsg.Update(gameTime, gameInput); _backToMenuBtn.Update(gameTime, gameInput); _continueBtn.Update(gameTime, gameInput); _quitBtn.Update(gameTime, gameInput); _hc.Update(gameTime, gameInput); // Action if (_backToMenuBtn.IsPressed()) { _nextScene = new MainMenu(); _sceneFinished = true; } else if (_continueBtn.IsPressed()) { switch (_fromLevel) { case 1: _nextScene = new Level1(gameInput); break; case 2: _nextScene = new Level2(gameInput); break; default: _nextScene = null; break; } _sceneFinished = true; } else if (_quitBtn.IsPressed()) { _nextScene = null; // Game will quit _sceneFinished = true; } }
public override void Update(GameTime gameTime, KinectInterface gameInput) { if (endLevel.TotalMilliseconds != 0) { double doneSince = Math.Round(gameTime.TotalGameTime.Subtract(endLevel).TotalSeconds, 1); if (doneSince == 3d) fadeEffect.Start(Fade.EFFECT.FADE_IN, Color.Black, 2000); if (doneSince == 5d) { _sceneFinished = true; _nextScene = new VictoryMenu(); } moveCamera(gameTime); items.Clear(); // moveCamera keep spawning squick.Update(gameTime); bounceAgainstWalls(squick); fadeEffect.Update(gameTime); message.Update(gameTime); return; } else if (cameraOffset > goal) { endLevel = gameTime.TotalGameTime; ScoreHolder.Level2 = (int)score((float)gameTime.TotalGameTime.Subtract(beginLevel).TotalSeconds); message.SetText("Level Clear"); } if(beginLevel.TotalMilliseconds == 0) beginLevel = gameTime.TotalGameTime; double startedSince = gameTime.TotalGameTime.Subtract(beginLevel).TotalSeconds; if (startedSince < 21d) { startedSince = Math.Round(startedSince, 1); if (startedSince == 5d) message.SetText("Move the branch"); else if (startedSince == 10d) message.SetText("Small branch = "); else if (startedSince == 12d) message.SetText("BIG JUMP"); else if (startedSince == 15d) message.SetText("Get Ready !"); else if (startedSince == 18d) message.SetText("go"); else if (startedSince == 20d) message.SetText(""); message.Update(gameTime); hc.Update(gameTime, gameInput); activeBranch.Update(gameTime); return; } else hc = null; /* Update everything */ squick.Update(gameTime); fadeEffect.Update(gameTime); gauge.Update(cameraOffset); message.Update(gameTime); activeBranch.Update(gameTime); oldBranches.RemoveAll(destroyable); foreach (Collectible i in items) i.Update(gameTime); foreach (Branch b in oldBranches) b.Update(gameTime); /* gravity & friction & bounce */ squick.SpeedY += gravity * (float) gameTime.ElapsedGameTime.TotalSeconds; squick.SpeedX *= (float) Math.Pow(friction, gameTime.ElapsedGameTime.TotalSeconds); bounceAgainstWalls(squick); /* make squick jump on branches */ processJump(gameInput, gameTime, activeBranch); foreach (Branch b in oldBranches) processJump(gameInput, gameTime, b); moveCamera(gameTime); if (squick.Speed.Y > 0 && squick.Pos.Y > 600) hitBottom(); foreach (Collectible i in items) if(squick.Collide(i)){ int impact = i.GetBonus(); if (i is GoldenNut) nbOfLives++; else if (i is Bomb) fadeEffect.Start(Fade.EFFECT.FADE_OUT, Color.White, 500.0f); else squick.Speed = newSpeedItem(squick.Speed, impact); squick.makeDizzy(); i.CollideWithPlayer(true); i.Destroy(); toBeDestroy.Add(i); } if (toBeDestroy.Count > 0) { items.RemoveAll(toBeDestroy.Contains); toBeDestroy.Clear(); } }