public Enemy(Random randomGen, Texture2D healthTexture, Vector2 screenSize, Texture2D theTexture, List <Texture2D> particleTextures, SoundEffect theLaserSound, Color[] theTextureData) {//initalize variables maxHealth = 25; fireRate = 0.01f; screenWidth = (int)screenSize.X; //set the screen height and width screenHeight = (int)screenSize.Y; texture = theTexture; GetPosition(randomGen); //get a random position around the edge of the screen GetVelocity(); //get a velocity depending on what side of the screen this position was GetRotation(); //get a rotation depending on direction speed = 4; laser = theLaserSound; textureData = theTextureData; origin.X = texture.Width / 2; origin.Y = texture.Height / 2; alive = true; bulletColor = Color.White; textureData = theTextureData; particleEngine = new ParticleEngine(particleTextures, Vector2.Zero, Color.Blue, Color.Yellow); for (int i = 0; i < MaxBullets; i++) { bullets[i] = new Bullet(screenWidth, screenHeight); } //health: currentHealth = maxHealth; backHealthBarColor = Color.Black; healthBarColor = Color.Green; currentHealthTex = healthTexture; healthBackgroundTex = currentHealthTex; healthBarWidth = HealthBarMaxLength; }
public Fighter(Random randomGen, Texture2D healthTexture, Vector2 screenSize, Texture2D theTexture, List <Texture2D> particleTextures, SoundEffect theLaserSound, Color[] theTextureData) : base(randomGen, healthTexture, screenSize, theTexture, particleTextures, theLaserSound, theTextureData) { speed = 0.9f; //slower bulletColor = Color.Magenta; //different colored bullets particleEngine = new ParticleEngine(particleTextures, Vector2.Zero, Color.Purple, Color.Blue); //different colours fireRate = 0.007f; //slow fire rate damage = 10; //twice the damage maxHealth = 50; //more health currentHealth = maxHealth; }
public void LoadContent(ContentManager theContentManager, string theAssetName, List <Texture2D> textures, SoundEffect theLaserSound) {//load in textures and sounds laser = theLaserSound; texture = theContentManager.Load <Texture2D>(theAssetName); origin.X = texture.Width / 2; //get origin after getting texture origin.Y = texture.Height / 2; textureData = new Color[texture.Width * texture.Height]; //get data for the player texture texture.GetData(textureData); particleEngine = new ParticleEngine(textures, new Vector2(400, 240), new Color(253, 162, 5), new Color(84, 202, 248)); //create new particle texture }
public AdvancedFighter(Random randomGen, Texture2D healthTexture, Vector2 screenSize, Texture2D theTexture, List <Texture2D> particleTextures, SoundEffect theLaserSound, Color[] theTextureData, Texture2D shieldTex) : base(randomGen, healthTexture, screenSize, theTexture, particleTextures, theLaserSound, theTextureData) { speed = 0.3f; //slower bulletColor = Color.LightSteelBlue; //different colored bullets particleEngine = new ParticleEngine(particleTextures, Vector2.Zero, Color.LightBlue, Color.SteelBlue); //different colours fireRate = 0.025f; //faster fire rate damage = 2; //less damage (fires faster) maxHealth = 100; //more health currentHealth = maxHealth; shielded = true; shieldHits = 8; shieldTexture = shieldTex; }