public void EnemyShoot() { if (bulletDelay >= 0) { bulletDelay--; } if (bulletDelay <= 0) { Bullet newBullet = new Bullet(bulletTexture); newBullet.position = new Vector2(position.X + texture.Width / 2 - newBullet.texture.Width / 2, position.Y + 30); newBullet.isVisible = true; if (bulletList.Count() < 15) bulletList.Add(newBullet); } if (bulletDelay == 0) { bulletDelay = 90; } }
//shoot: used to set starting position of our bullet public void Shoot() { //shoot only if bullet delay resets if (bulletDelay >= 0) bulletDelay--; //if bullet delay is at 0; create new bullet at player position, make it visible on the screen, then add that bullet to the List if (bulletDelay <= 0) { sm.playerShootSound.Play(); Bullet newBullet = new Bullet(bulletTexture); newBullet.position = new Vector2(position.X + 32 - newBullet.texture.Width / 2, position.Y + 30); newBullet.isVisible = true; if (bulletList.Count() < 20) bulletList.Add(newBullet); } //reset bullet delay if (bulletDelay == 0) bulletDelay = 20; }