public GameplayScreen(Game1 game, Vector2 worldSize, Levels currentLevel) : base(game) { this.worldSize = worldSize; eCurrentLevel = currentLevel; heatmapWriteTimer = 0; //Make the tree a bit wider for outer walls. quadTree = new QuadTree(new Rectangle( -10, -10, (int)worldSize.X + 20, (int)worldSize.Y + 20)); //Add the 4 walls on the outside of the world. Components.Add(new Wall(GDGame, new Vector2(-10, -10), new Vector2(worldSize.X + 10, 0))); Components.Add(new Wall(GDGame, new Vector2(worldSize.X, -10), new Vector2(worldSize.X + 10, worldSize.Y))); Components.Add(new Wall(GDGame, new Vector2(0, worldSize.Y), new Vector2(worldSize.X + 10, worldSize.Y + 10))); Components.Add(new Wall(GDGame, new Vector2(-10, 0), new Vector2(0, worldSize.Y + 10))); //Add the player to world. Components.Add(Player = new PlayerBall(GDGame, new Vector2(300, 300))); //Give the camera the new world size. GDGame.Camera.WorldSize = worldSize + new Vector2(0, 100); gameOver = won = false; GDGame.IsMouseVisible = false; }
private void PlayerHit(PlayerBall playerBall) { if (Remove) { return; } switch (ScoreState) { case State.Enemy: playerBall.SubtractScore(); break; case State.Friendly: playerBall.AddScore(); break; } //Let the spawner remove this Scoreball. Spawner.GetInstance().RemoveBall(this); }