Beispiel #1
0
        public void shootBullet(BulletType bulletType, Direction d, int speed, float scale)
        {
            if (!this.hasPowerUp(PowerUpType.DoubleShot))
            {
                Bullet bullet = new Bullet(bulletType, new Vector2());
                bullet.Width = (int)(bullet.Width * scale);
                bullet.Height = (int)(bullet.Height * scale);

                if (d == Direction.North)
                {
                    bullet.X = this.X + this.Width / 2 - bullet.Width / 2;
                    bullet.Y = this.Y - bullet.Height;
                }
                else if (d == Direction.South)
                {
                    bullet.X = this.X + this.Width / 2 - bullet.Width / 2;
                    bullet.Y = this.Y + this.Height;
                }
                else if (d == Direction.West)
                {
                    bullet.X = this.X - bullet.Width;
                    bullet.Y = this.Y + this.Height / 2 - bullet.Height / 2;
                }
                else if (d == Direction.East)
                {
                    bullet.X = this.X + this.Width;
                    bullet.Y = this.Y + this.Height / 2 - bullet.Height / 2;
                }
                else if (d == Direction.NorthEast)
                {
                    bullet.X = this.X + this.Width;
                    bullet.Y = this.Y - bullet.Height;
                }
                else if (d == Direction.SouthEast)
                {
                    bullet.X = this.X + this.Width;
                    bullet.Y = this.Y + this.Height;
                }
                else if (d == Direction.NorthWest)
                {
                    bullet.X = this.X - bullet.Width;
                    bullet.Y = this.Y - bullet.Height;
                }
                else if (d == Direction.SouthWest)
                {
                    bullet.X = this.X - bullet.Width;
                    bullet.Y = this.Y + this.Height;
                }

                bullet.speed.X = speed * d.X;
                bullet.speed.Y = speed * d.Y;
            }
            else
            {
                Bullet bullet1 = new Bullet(bulletType, new Vector2());
                Bullet bullet2 = new Bullet(bulletType, new Vector2());
                bullet1.Width = (int)(bullet1.Width * scale);
                bullet1.Height = (int)(bullet1.Height * scale);
                bullet2.Width = (int)(bullet2.Width * scale);
                bullet2.Height = (int)(bullet2.Height * scale);

                if (d == Direction.North)
                {
                    bullet1.X = this.X + (int)(this.Width * .33f) - bullet1.Width / 2;
                    bullet2.X = this.X + (int)(this.Width * .66f) - bullet2.Width / 2;
                    bullet1.Y = bullet2.Y = this.Y - bullet1.Height;
                }
                else if (d == Direction.South)
                {
                    bullet1.X = this.X + (int)(this.Width * .33f) - bullet1.Width / 2;
                    bullet2.X = this.X + (int)(this.Width * .66f) - bullet2.Width / 2;
                    bullet1.Y = bullet2.Y = this.Y + this.Height;
                }
                else if (d == Direction.West)
                {
                    bullet1.X = bullet2.X = this.X - bullet1.Width;
                    bullet1.Y = this.Y + (int)(this.Height * .33f) - bullet1.Height / 2;
                    bullet2.Y = this.Y + (int)(this.Height * .66f) - bullet1.Height / 2;
                }
                else if (d == Direction.East)
                {
                    bullet1.X = bullet2.X = this.X + this.Width;
                    bullet1.Y = this.Y + (int)(this.Height * .33f) - bullet1.Height / 2;
                    bullet2.Y = this.Y + (int)(this.Height * .66f) - bullet1.Height / 2;
                }
                else if (d == Direction.NorthEast)
                {
                    bullet1.X = this.X + (int)(this.Width * .85f) - bullet1.Width / 2;
                    bullet1.Y = this.Y - bullet1.Height;
                    bullet2.X = this.X + this.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .15f) - bullet2.Height / 2;
                }
                else if (d == Direction.SouthEast)
                {
                    bullet1.X = this.X + (int)(this.Width * .85f) - bullet1.Width / 2;
                    bullet1.Y = this.Y + this.Height;
                    bullet2.X = this.X + this.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .85f) - bullet2.Height / 2;
                }
                else if (d == Direction.NorthWest)
                {
                    bullet1.X = this.X + (int)(this.Width * .15f) - bullet1.Width / 2;
                    bullet1.Y = this.Y - bullet1.Height;
                    bullet2.X = this.X - bullet2.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .15f) - bullet2.Height / 2;
                }
                else if (d == Direction.SouthWest)
                {
                    bullet1.X = this.X + (int)(this.Height * .15f) - bullet1.Width / 2;
                    bullet1.Y = this.Y + this.Height;
                    bullet2.X = this.X - bullet2.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .85f) - bullet2.Height / 2;
                }
                bullet1.speed.X = bullet2.speed.X = speed * d.X;
                bullet1.speed.Y = bullet2.speed.Y = speed * d.Y;
            }
        }
Beispiel #2
0
 // isaac shoot
 public void shootBullet(BulletType bulletType, Direction d, int speed)
 {
     shootBullet(bulletType, d, speed, 1);
 }
Beispiel #3
0
        public void shootBullet(BulletType bulletType, Direction d, int speed, float scale)
        {
            if (!this.hasPowerUp(PowerUpType.DoubleShot))
            {
                Bullet bullet = new Bullet(bulletType, new Vector2());
                bullet.Width  = (int)(bullet.Width * scale);
                bullet.Height = (int)(bullet.Height * scale);

                if (d == Direction.North)
                {
                    bullet.X = this.X + this.Width / 2 - bullet.Width / 2;
                    bullet.Y = this.Y - bullet.Height;
                }
                else if (d == Direction.South)
                {
                    bullet.X = this.X + this.Width / 2 - bullet.Width / 2;
                    bullet.Y = this.Y + this.Height;
                }
                else if (d == Direction.West)
                {
                    bullet.X = this.X - bullet.Width;
                    bullet.Y = this.Y + this.Height / 2 - bullet.Height / 2;
                }
                else if (d == Direction.East)
                {
                    bullet.X = this.X + this.Width;
                    bullet.Y = this.Y + this.Height / 2 - bullet.Height / 2;
                }
                else if (d == Direction.NorthEast)
                {
                    bullet.X = this.X + this.Width;
                    bullet.Y = this.Y - bullet.Height;
                }
                else if (d == Direction.SouthEast)
                {
                    bullet.X = this.X + this.Width;
                    bullet.Y = this.Y + this.Height;
                }
                else if (d == Direction.NorthWest)
                {
                    bullet.X = this.X - bullet.Width;
                    bullet.Y = this.Y - bullet.Height;
                }
                else if (d == Direction.SouthWest)
                {
                    bullet.X = this.X - bullet.Width;
                    bullet.Y = this.Y + this.Height;
                }

                bullet.speed.X = speed * d.X;
                bullet.speed.Y = speed * d.Y;
            }
            else
            {
                Bullet bullet1 = new Bullet(bulletType, new Vector2());
                Bullet bullet2 = new Bullet(bulletType, new Vector2());
                bullet1.Width  = (int)(bullet1.Width * scale);
                bullet1.Height = (int)(bullet1.Height * scale);
                bullet2.Width  = (int)(bullet2.Width * scale);
                bullet2.Height = (int)(bullet2.Height * scale);

                if (d == Direction.North)
                {
                    bullet1.X = this.X + (int)(this.Width * .33f) - bullet1.Width / 2;
                    bullet2.X = this.X + (int)(this.Width * .66f) - bullet2.Width / 2;
                    bullet1.Y = bullet2.Y = this.Y - bullet1.Height;
                }
                else if (d == Direction.South)
                {
                    bullet1.X = this.X + (int)(this.Width * .33f) - bullet1.Width / 2;
                    bullet2.X = this.X + (int)(this.Width * .66f) - bullet2.Width / 2;
                    bullet1.Y = bullet2.Y = this.Y + this.Height;
                }
                else if (d == Direction.West)
                {
                    bullet1.X = bullet2.X = this.X - bullet1.Width;
                    bullet1.Y = this.Y + (int)(this.Height * .33f) - bullet1.Height / 2;
                    bullet2.Y = this.Y + (int)(this.Height * .66f) - bullet1.Height / 2;
                }
                else if (d == Direction.East)
                {
                    bullet1.X = bullet2.X = this.X + this.Width;
                    bullet1.Y = this.Y + (int)(this.Height * .33f) - bullet1.Height / 2;
                    bullet2.Y = this.Y + (int)(this.Height * .66f) - bullet1.Height / 2;
                }
                else if (d == Direction.NorthEast)
                {
                    bullet1.X = this.X + (int)(this.Width * .85f) - bullet1.Width / 2;
                    bullet1.Y = this.Y - bullet1.Height;
                    bullet2.X = this.X + this.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .15f) - bullet2.Height / 2;
                }
                else if (d == Direction.SouthEast)
                {
                    bullet1.X = this.X + (int)(this.Width * .85f) - bullet1.Width / 2;
                    bullet1.Y = this.Y + this.Height;
                    bullet2.X = this.X + this.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .85f) - bullet2.Height / 2;
                }
                else if (d == Direction.NorthWest)
                {
                    bullet1.X = this.X + (int)(this.Width * .15f) - bullet1.Width / 2;
                    bullet1.Y = this.Y - bullet1.Height;
                    bullet2.X = this.X - bullet2.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .15f) - bullet2.Height / 2;
                }
                else if (d == Direction.SouthWest)
                {
                    bullet1.X = this.X + (int)(this.Height * .15f) - bullet1.Width / 2;
                    bullet1.Y = this.Y + this.Height;
                    bullet2.X = this.X - bullet2.Width;
                    bullet2.Y = this.Y + (int)(this.Height * .85f) - bullet2.Height / 2;
                }
                bullet1.speed.X = bullet2.speed.X = speed * d.X;
                bullet1.speed.Y = bullet2.speed.Y = speed * d.Y;
            }
        }
Beispiel #4
0
 public DebugMonitor(Game game)
     : base(game)
 {
     position = Direction.NorthEast;
 }
Beispiel #5
0
 // isaac shoot
 public void shootBullet(BulletType bulletType, Direction d, int speed)
 {
     shootBullet(bulletType, d, speed, 1);
 }