Exemplo n.º 1
0
        public void ShootBullet()   //Shoots a bullet at mouse cursor from players position
        {
            bulletStartPos = player.getPos();

            //Aim at mouse logic
            mousePosition   = KeyMouseReader.getNewPos();
            bulletDirection = mousePosition - bulletStartPos;
            if (bulletDirection != Vector2.Zero)
            {
                bulletDirection.Normalize();
            }

            bulletHitbox = new Rectangle((int)bulletStartPos.X, (int)bulletStartPos.Y, bullet_texture.Width, bullet_texture.Height);
            bullets.Add(new Bullet(bullet_texture, bulletStartPos, bulletDirection, bulletSpeed, bulletHitbox));
            soundBank.PlayCue("se_damage00");
        }