public override void Update(GameTime time) { if (TheLastSliceGame.InputManager.IsInputPressed(Keys.Enter)) { TheLastSliceGame.Instance.ChangeState(GameState.Menu, UIType.MainMenu); } SnakeInTheBox.Update(time); ArrowLeft.Update(time); ArrowRight.Update(time); }
public override void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(Background, new Vector2(0, 0), Color.White); spriteBatch.Draw(Leaderboard, new Vector2(TheLastSliceGame.Instance.GameWidth / 2 - Leaderboard.Width / 2, 25), Color.White); int yPos = 100; int numEntriesToShow = (LeaderboardList.Count <= 10) ? LeaderboardList.Count : 10; int yOffset = 10; for (int i = 0; i < numEntriesToShow; i++) { LeaderboardEntry entry = LeaderboardList[i]; spriteBatch.DrawString(Text, entry.Initials, new Vector2(200, yPos), ColorYellow); if (entry.Challenge1 != null) { spriteBatch.Draw(entry.Challenge1, new Vector2(300, yPos - yOffset), Color.White); } if (entry.Challenge2 != null) { spriteBatch.Draw(entry.Challenge2, new Vector2(400, yPos - yOffset), Color.White); } if (entry.Challenge3 != null) { spriteBatch.Draw(entry.Challenge3, new Vector2(500, yPos - yOffset), Color.White); } yPos += 40; } if (SnakeInTheBox.AnimationManager.Animation.CurrentFrame % 2 == 0) { Vector2 newSnakePos = new Vector2(SnakeInTheBox.Position.X + 1, SnakeInTheBox.Position.Y); SnakeInTheBox.Position = newSnakePos; SnakeInTheBox.AnimationManager.Position = newSnakePos; } if (SnakeInTheBox.Position.X < TheLastSliceGame.Instance.GameWidth) { SnakeInTheBox.Draw(spriteBatch); } ArrowLeft.Draw(spriteBatch); ArrowRight.Draw(spriteBatch); spriteBatch.Draw(Exit, new Vector2(TheLastSliceGame.Instance.GameWidth / 2 - Exit.Width / 2, 525), Color.White); }