private void AddLazorBeam(Vector2 position) { Animation lazorBeamAnimation = new Animation(); Texture2D lazorBeamTexture = Content.Load <Texture2D>("Animation/LazorBeam"); lazorBeamAnimation.Initialize(lazorBeamTexture, position, 32, 32, 19, 30, Color.White, 1f, true); LazorBeam lazorBeam = new LazorBeam(); lazorBeam.Initialize(lazorBeamAnimation, position); lazorBeams.Add(lazorBeam); }
/// <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() { // TODO: Add your initialization logic here // Initialize the player class player = new Player(); // Set a constant player move speed playerMoveSpeed = 8.0f; //Enable the FreeDrag gesture. TouchPanel.EnabledGestures = GestureType.FreeDrag; bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); // Initialize the enemies list enemies = new List <Enemy> (); // Set the time keepers to zero previousSpawnTime = TimeSpan.Zero; // Used to determine how fast enemy respawns enemySpawnTime = TimeSpan.FromSeconds(1.0f); // Initialize our random number generator random = new Random(); projectiles = new List <Projectile>(); // Set the laser to fire every quarter second fireTime = TimeSpan.FromSeconds(.15f); lazorBeams = new List <LazorBeam> (); lazorBeam = new Shooter.LazorBeam(); fireLazor = TimeSpan.FromSeconds(3f); explosions = new List <Animation>(); //Set player's score to zero score = 0; base.Initialize(); }