Ejemplo n.º 1
0
        private bool collidedWithGun(Bullet b)
        {
            if (b.player == this.player)
                return false;

            if (gun.thrown)
            {
                if (b.position.X > gun.thrownPosition.X + GUN_RADIUS)
                    return false;
                else if (b.position.X < gun.thrownPosition.X - GUN_RADIUS)
                    return false;
                else if (b.position.Y < gun.thrownPosition.Y - GUN_RADIUS)
                    return false;
                else if (b.position.Y > gun.thrownPosition.Y + GUN_RADIUS)
                    return false;
            }
            else{
                if (b.position.X > gun.position.X + GUN_RADIUS)
                    return false;
                else if (b.position.X < gun.position.X - GUN_RADIUS)
                    return false;
                else if (b.position.Y < gun.position.Y - GUN_RADIUS)
                    return false;
                else if (b.position.Y > gun.position.Y + GUN_RADIUS)
                    return false;
            }
            return true;
        }
Ejemplo n.º 2
0
        private bool collidedWithPlayer(Bullet b)
        {
            if (b.player == this.player)
                return false;
            else if (b.position.X > BODY_RIGHT)
                return false;
            else if (b.position.Y < BODY_TOP)
                return false;
            else if (b.position.Y > BODY_BOTTOM)
                return false;

            return true;
        }
Ejemplo n.º 3
0
 internal void swapBullet(Bullet b, DuelScreen screen)
 {
     b.rotation = mirrorAngle(b.rotation);
     if (screen == p1Screen)
         ((DuelScreen)p2Screen).firedBullets.Add(b);
     else if (screen == p2Screen)
         ((DuelScreen)p1Screen).firedBullets.Add(b);
 }