public void EnemyShootMissiles() { //shoot only if bull delay resets if (bossMissDelay >= 0) bossMissDelay--; if (bossMissDelay <= 0) { //create bullet for enemy, at center of texture Missile newMiss = new Missile(bossMissTexture); newMiss.missilePosition = new Vector2(bossPosition.X + bossTexture.Width / 2 - newMiss.missileTexture.Width / 2, bossPosition.Y + bossTexture.Height); newMiss.onScreen = true; if (bossHealth <= 20000 && bossMissList.Count < 1) { bossMissList.Add(newMiss); } } if (bossBullDelay == 1000) bossBullDelay = 1000; }
public void fireMissiles() { //shoot if delay resets if (playerMissileDelay >= 0) playerMissileDelay--; //if bulletdelay at 0; create new bullet at player position, show on screen and add it to the bullet list if (playerMissileDelay <= 0) { sm.missileLaunchSound.Play(); Missile newMissile = new Missile(playerMissileTexture); newMissile.missilePosition = new Vector2(position.X + 45 - newMissile.missileTexture.Width / 2, position.Y - 45); newMissile.onScreen = true; if (playerMissileList.Count() < 40) playerMissileList.Add(newMissile); playerMissileList.Add(newMissile); } //reset bullet delay if (playerMissileDelay == 0) playerMissileDelay = 20; }