public void Initialize(Animation animation, Vector2 position) { PlayerAnimation = animation; // PlayerTexture3 = texture; Position3 = position; Active = true; Health = 100; Score = 0; Power = 10; DamageMod = 0; shieldActive = false; Damage = 10; Shield = 0; }
//this addballoonenemy probably be taken out. but can add more later //private void AddFireHair() //{ // FireHair fireHairEnemy = new FireHair(); // Vector2 position = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + fireHairTexture.Width / 2, random.Next(100, ScreenManager.GraphicsDevice.Viewport.Height - 70)); // fireHairEnemy.Initialize(ScreenManager.GraphicsDevice.Viewport, fireHairTexture, position, 40); // fireHairEnemies.Add(fireHairEnemy); //} //private void AddBalloonEnemy() //{ // //create the animation object // Animation balloonEnemyAnimation = new Animation(); // //initizlize theanimation with the correct ahimation information // balloonEnemyAnimation.Initialize(balloonEnemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true); // //randomly generate the position of the enemy or later change this to a specific spot // Vector2 position = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, ScreenManager.GraphicsDevice.Viewport.Height - 100)); // //create an enemy // GreenMineEnemy balloonEnemy = new GreenMineEnemy(); // //initizlize the enemy // balloonEnemy.Initialize(balloonEnemyAnimation, position); // // add the enemy to the active enemies list // balloonEnemies.Add(balloonEnemy); //} private void AddExplosion(Vector2 position) { Animation explosion = new Animation(); explosion.Initialize(explosion1Texture, position, 134, 134, 12, 45, Color.White, 1f, false); explosions.Add(explosion); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); //todo figure out which background to use newBackground = new Background(content, @"Graphics\Backgrounds\PrimaryStar", @"Graphics\Backgrounds\ParallaxStars", ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); // bgLayer1 = new ParallaxingBackground(); //bgLayer2 = new ParallaxingBackground(); // star1 = new ScrollingBackground(); // star2 = new ScrollingBackground(); // score postion setting scorePosition = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Y); // scoreString = GetScoreString(player.Score); //todo not working yet for effects // standardEffect = content.Load<Effect>(@"Effects\Standard"); iLivesLeft = 3; gameFont = content.Load<SpriteFont>(@"Graphics\gamefont"); //load paralzxing background // bgLayer1.Initialize(content, @"Graphics\bgLayer1", ScreenManager.GraphicsDevice.Viewport.Width, -1); // bgLayer2.Initialize(content, @"Graphics\bglayer2", ScreenManager.GraphicsDevice.Viewport.Width, -2); // try scrolling // star1.Initialize(content, @"Graphics\Backgrounds\star1", ScreenManager.GraphicsDevice.Viewport.Width, -1); // star2.Initialize(content, @"Graphics\Backgrounds\star6", ScreenManager.GraphicsDevice.Viewport.Width, -1); //load enemies textures asteroidTexture2 = content.Load<Texture2D>(@"Graphics\asteroid01"); //asteroidTexture = content.Load<Texture2D>(@"Graphics\asteroid01"); // powerupDamageTexture = content.Load<Texture2D>(@"Graphics\powerup"); //powerupShieldTexture = content.Load<Texture2D>(@"Graphics\shieldpowerup"); mainBackground = content.Load<Texture2D>(@"Graphics\mainbackground"); scoreFont = content.Load<SpriteFont>(@"Graphics\gameFont"); //initialize projectile projectiles = new List<Projectile>(); //powerups // damagePowerUps = new List<PowerUp>(); //shieldPowerUps = new List<PowerUp>(); //set the laser to fie every quarter second //fireTime = TimeSpan.FromSeconds(.15f); //load projectile projectileTexture = content.Load<Texture2D>(@"Graphics\lasergreen"); // explosions explosions = new List<Animation>(); explosion1Texture = content.Load<Texture2D>(@"Graphics\explosion"); //initialize asteroid asteroids2 = new List<AsteroidEnemy2>(); //asteroids = new List<AsteroidEnemy>(); previousAsteroidSpawnTime = TimeSpan.Zero; asteroidSpawnTime = TimeSpan.FromSeconds(10f); //randomAsteroid = new Random(); //initialize enemies list etc.. ; //set enemy spawn time keepers to zero // previousSpawnTime = TimeSpan.Zero; //used to determine how fast enemy respawns // powerUpSpawnTime = TimeSpan.FromSeconds(10.0f); // previousPowerUpSpawnTime = TimeSpan.Zero; previousDeathTime = TimeSpan.Zero; deathTime = TimeSpan.FromSeconds(1.0f); //initialize random number for enemies // randomEnemy = new Random(); //randomPowerUp = new Random(); //initialize a new player. not sure why have to do it here. player = new Player(); //try projectile hee gameOver = false; //score = 0; //use animation now. Animation playerAnimation = new Animation(); Texture2D playerTexture = content.Load<Texture2D>(@"Graphics\shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Vector2 playerPosition3 = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Y + ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); player.Initialize(playerAnimation, playerPosition3); //----animation section ^ // player.Initialize(content.Load<Texture2D>(@"Graphics\player"), playerPosition3); playerMoveSpeed = 8.0f; // Thread.Sleep(1000); //await Task.Delay(TimeSpan.FromSeconds(30)); //todo take out music when switch menus // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); }