/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Run this first will cause LoadContent to be triggered before initialize base.Initialize(); // TO DO: Add your initialization logic here IsMouseVisible = true; // Instanciate the Paddle signleton and Add it to the EntitiesManager. EntityManager.Add(new Paddle()); EntityManager.Add(new Ball()); Vector2 pos = new Vector2(80, 80); Vector2 scale = new Vector2(1, 0.5f); Rectangle rect = Art.GetSourceRectangle("brick_01"); for (int i = 0; i < 10; i++) { EntityManager.Add(new Brick("brick_01", pos, scale)); pos += rect.Width * scale; } }
private void Initialize(string brickName, Vector2 position, Vector2 scale) { this.SourceRect = Art.GetSourceRectangle(brickName); this.Position = position; this.Scale = scale; }