public List <Bullet> ShootLikeGrunt2(Vector2 position, Texture2D Texture, Texture2D bulletTexture) { List <Bullet> bullets = new List <Bullet>(); Bullet newBullet = new Bullet(bulletTexture); Bullet newBullet2 = new Bullet(bulletTexture); Bullet newBullet3 = new Bullet(bulletTexture); newBullet.bulletVelocity.X = 3; newBullet.bulletVelocity.Y = 3; newBullet.damage = 20; newBullet2.bulletVelocity.X = 0; newBullet2.bulletVelocity.Y = 3; newBullet2.damage = 20; newBullet3.bulletVelocity.X = -3; newBullet3.bulletVelocity.Y = 3; newBullet3.damage = 20; newBullet.ActivateBullet(); newBullet2.ActivateBullet(); newBullet3.ActivateBullet(); newBullet.bulletPosition = newBullet2.bulletPosition = newBullet3.bulletPosition = new Vector2(position.X, position.Y + (Texture.Height / 2) - (bulletTexture.Height / 2)); if (bullets.Count() < 3) { bullets.Add(newBullet); bullets.Add(newBullet2); bullets.Add(newBullet3); } return(bullets); }
public List <Bullet> Shoot(Vector2 position, Texture2D Texture, Texture2D bulletTexture, KeyboardState previousKey, GameTime gameTime) { List <Bullet> bullets = new List <Bullet>(); Bullet newBullet = new Bullet(bulletTexture); Bullet newBullet2 = new Bullet(bulletTexture); Bullet newBullet3 = new Bullet(bulletTexture); newBullet.bulletVelocity.X = 3; newBullet.bulletVelocity.Y = 3; newBullet.damage = 20; newBullet2.bulletVelocity.X = 0; newBullet2.bulletVelocity.Y = 3; newBullet2.damage = 20; newBullet3.bulletVelocity.X = -3; newBullet3.bulletVelocity.Y = 3; newBullet3.damage = 20; newBullet.ActivateBullet(); newBullet2.ActivateBullet(); newBullet3.ActivateBullet(); newBullet.bulletPosition = newBullet2.bulletPosition = newBullet3.bulletPosition = new Vector2(position.X, position.Y + (Texture.Height / 2) - (bulletTexture.Height / 2)); int shoot = gameTime.TotalGameTime.Milliseconds; if (shoot == 500 && bullets.Count() < 9) { bullets.Add(newBullet); bullets.Add(newBullet2); bullets.Add(newBullet3); } return(bullets); }
public List <Bullet> Shoot(Vector2 position, Texture2D Texture, Texture2D bulletTexture, KeyboardState previousKey, GameTime gameTime) { List <Bullet> bullets = new List <Bullet>(); if (Keyboard.GetState().IsKeyDown(Keys.Space) && previousKey.IsKeyUp(Keys.Space)) { shootingSounds[0].Play(); Bullet newBullet = new Bullet(bulletTexture); newBullet.bulletVelocity.X = 0; newBullet.bulletVelocity.Y = -10; newBullet.ActivateBullet(); newBullet.damage = 10; newBullet.bulletPosition = new Vector2(position.X, position.Y); bullets.Add(newBullet); } return(bullets); }
// Update is called once per frame void Update() { childRotater.transform.Rotate(Vector3.forward * Time.deltaTime * 45.0f); if (shootTime <= 0.0f) { for (int i = 0; i < spawnBulletPositions.Length; i++) { bulletToShoot = gameBullets.GetBullet(); bulletToShoot.transform.position = spawnBulletPositions[i].transform.position; bulletToShoot.transform.rotation = spawnBulletPositions[i].transform.rotation; bulletToShoot.ActivateBullet(); } shootTime = originalShootTime; } else { shootTime -= Time.deltaTime; } }
public List <Bullet> Shoot(Vector2 position, Texture2D Texture, Texture2D bulletTexture, KeyboardState previousKey, GameTime gameTime) { List <Bullet> bullets = new List <Bullet>(); Bullet newBullet = new Bullet(bulletTexture); Bullet newBullet2 = new Bullet(bulletTexture); Bullet newBullet3 = new Bullet(bulletTexture); Bullet newBullet4 = new Bullet(bulletTexture); Bullet newBullet5 = new Bullet(bulletTexture); Bullet newBullet6 = new Bullet(bulletTexture); Bullet newBullet7 = new Bullet(bulletTexture); Bullet newBullet8 = new Bullet(bulletTexture); newBullet.bulletVelocity.X = 0; newBullet.bulletVelocity.Y = -3; newBullet.damage = 10; newBullet2.bulletVelocity.X = 0; newBullet2.bulletVelocity.Y = 3; newBullet2.damage = 10; newBullet3.bulletVelocity.X = 3; newBullet3.bulletVelocity.Y = 0; newBullet3.damage = 10; newBullet4.bulletVelocity.X = -3; newBullet4.bulletVelocity.Y = 0; newBullet4.damage = 10; newBullet5.bulletVelocity.X = (float)1.5; newBullet5.bulletVelocity.Y = (float)2.75; newBullet5.damage = 10; newBullet6.bulletVelocity.X = (float)-1.5; newBullet6.bulletVelocity.Y = (float)2.75; newBullet6.damage = 10; newBullet7.bulletVelocity.X = (float)1.5; newBullet7.bulletVelocity.Y = (float)-2.75; newBullet7.damage = 10; newBullet8.bulletVelocity.X = (float)-1.5; newBullet8.bulletVelocity.Y = (float)-2.75; newBullet8.damage = 10; newBullet.ActivateBullet(); newBullet2.ActivateBullet(); newBullet3.ActivateBullet(); newBullet4.ActivateBullet(); newBullet5.ActivateBullet(); newBullet6.ActivateBullet(); newBullet7.ActivateBullet(); newBullet8.ActivateBullet(); newBullet.bulletPosition = newBullet2.bulletPosition = newBullet3.bulletPosition = newBullet4.bulletPosition = newBullet5.bulletPosition = newBullet6.bulletPosition = newBullet7.bulletPosition = newBullet8.bulletPosition = new Vector2(position.X + (Texture.Width / 2) - (bulletTexture.Width / 2), position.Y + (Texture.Height / 2) - (bulletTexture.Height / 2)); int shoot = gameTime.TotalGameTime.Milliseconds; if (shoot == 500 && bullets.Count() < 8) { bullets.Add(newBullet); bullets.Add(newBullet2); bullets.Add(newBullet3); bullets.Add(newBullet4); bullets.Add(newBullet5); bullets.Add(newBullet6); bullets.Add(newBullet7); bullets.Add(newBullet8); } return(bullets); }
public void PoolBullet(Bullet bullet) { bullet.ActivateBullet(false); _bulletStack.Push(bullet); }
public List <Bullet> ShootLikeMidBoss(Vector2 position, Texture2D Texture, Texture2D bulletTexture) { List <Bullet> bullets = new List <Bullet>(); Bullet newBullet = new Bullet(bulletTexture); Bullet newBullet2 = new Bullet(bulletTexture); Bullet newBullet3 = new Bullet(bulletTexture); Bullet newBullet4 = new Bullet(bulletTexture); Bullet newBullet5 = new Bullet(bulletTexture); Bullet newBullet6 = new Bullet(bulletTexture); Bullet newBullet7 = new Bullet(bulletTexture); Bullet newBullet8 = new Bullet(bulletTexture); newBullet.bulletVelocity.X = 0; newBullet.bulletVelocity.Y = -3; newBullet.damage = 10; newBullet2.bulletVelocity.X = 0; newBullet2.bulletVelocity.Y = 3; newBullet2.damage = 10; newBullet3.bulletVelocity.X = 3; newBullet3.bulletVelocity.Y = 0; newBullet3.damage = 10; newBullet4.bulletVelocity.X = -3; newBullet4.bulletVelocity.Y = 0; newBullet4.damage = 10; newBullet5.bulletVelocity.X = (float)1.5; newBullet5.bulletVelocity.Y = (float)2.75; newBullet5.damage = 10; newBullet6.bulletVelocity.X = (float)-1.5; newBullet6.bulletVelocity.Y = (float)2.75; newBullet6.damage = 10; newBullet7.bulletVelocity.X = (float)1.5; newBullet7.bulletVelocity.Y = (float)-2.75; newBullet7.damage = 10; newBullet8.bulletVelocity.X = (float)-1.5; newBullet8.bulletVelocity.Y = (float)-2.75; newBullet8.damage = 10; newBullet.ActivateBullet(); newBullet2.ActivateBullet(); newBullet3.ActivateBullet(); newBullet4.ActivateBullet(); newBullet5.ActivateBullet(); newBullet6.ActivateBullet(); newBullet7.ActivateBullet(); newBullet8.ActivateBullet(); newBullet.bulletPosition = newBullet2.bulletPosition = newBullet3.bulletPosition = newBullet4.bulletPosition = newBullet5.bulletPosition = newBullet6.bulletPosition = newBullet7.bulletPosition = newBullet8.bulletPosition = new Vector2(position.X + (Texture.Width / 2) - (bulletTexture.Width / 2), position.Y + (Texture.Height / 2) - (bulletTexture.Height / 2)); if (bullets.Count() < 8) { bullets.Add(newBullet); bullets.Add(newBullet2); bullets.Add(newBullet3); bullets.Add(newBullet4); bullets.Add(newBullet5); bullets.Add(newBullet6); bullets.Add(newBullet7); bullets.Add(newBullet8); } return(bullets); }