public void EnemyShoot() { //shoot only if bull delay resets if (bossBullDelay >= 0) bossBullDelay--; if (bossBullDelay <= 0) { //create bullet for enemy, at center of texture Projectile newBullet = new Projectile(bossBullTexture); newBullet.projectilePosition = new Vector2(bossPosition.X + bossTexture.Width / 2 - newBullet.projectileTexture.Width / 2, bossPosition.Y + bossTexture.Height); newBullet.onScreen = true; if (bossBullList.Count() < 20) bossBullList.Add(newBullet); } if (bossBullDelay == 100) bossBullDelay = 100; }
public void ShootProjectiles() { //shoot if delay resets if (playerBullDelay >= 0) playerBullDelay--; //if bulletdelay at 0; create new bullet at player position, show on screen and add it to the bullet list if (playerBullDelay <= 0) { sm.playerShootSound.Play(); Projectile newBullet = new Projectile(playerBullTexture); Projectile newBullet1 = new Projectile(playerBullTexture); newBullet.projectilePosition = new Vector2(position.X + 45 - newBullet.projectileTexture.Width / 2, position.Y -45); newBullet1.projectilePosition = new Vector2(position.X - 45 - newBullet.projectileTexture.Width / 2, position.Y -45); newBullet.onScreen = true; newBullet1.onScreen = true; if (playerBullList.Count() < 40) playerBullList.Add(newBullet); playerBullList.Add(newBullet1); } //reset bullet delay if (playerBullDelay == 0) playerBullDelay = 5; }