// Splits the tree into four subnodes public void Split() { int subWidth = bounds.Width / 2; int subHeight = bounds.Height / 2; int subX = bounds.X; int subY = bounds.Y; subnodes[0] = new QuadTree(level + 1, new Rectangle(subX, subY, subWidth, subHeight)); subnodes[1] = new QuadTree(level + 1, new Rectangle(subX + subWidth, subY, subWidth, subHeight)); subnodes[2] = new QuadTree(level + 1, new Rectangle(subX, subY + subHeight, subWidth, subHeight)); subnodes[3] = new QuadTree(level + 1, new Rectangle(subX + subWidth, subY + subHeight, subWidth, subHeight)); }
public override void Initialize() { scriptManager = new ScriptManager(); gameObjects = new List<GameObject>(); animations = new List<Animation>(); ExtendValues = new List<int>() { 10000, 25000, 50000, 100000, 200000, 400000, 800000, 1600000, 3200000, 6400000, 12800000, 25600000, }; if (AsteroidRebuttal.HardcoreMode) { ExtendValues.Clear(); Lives = 0; } // Set the game area to 700 x 650. ScreenArea = new Rectangle(0, 0, 700, 650); fader = new Fader(this); // Set the UI window to 150 x 650, beginning after the ScreenArea. GUIArea = new Rectangle(700, 0, 225, 650); quadtree = new QuadTree(0, ScreenArea); collisionDetection = new CollisionDetection(this); levelManager = new LevelManager(this); // Test levelManager.SetLevel(1); //new FinalBoss(this, new Vector2(350, -300)); player = new PlayerShip(this, new Vector2(350, 550)); }