コード例 #1
0
        public static void RandomPlacementOfItems()
        {
            Random rand = new Random();

            ItemType[] items = new ItemType[]
            {
                ItemType.BigPower,
                ItemType.Bomb,
                ItemType.FullPower,
                ItemType.Life,
                ItemType.Point,
                ItemType.Power,
                ItemType.Star
            };

            int[] trigger = new int[]
            {
                rand.Next() % 340 + 600,
                  rand.Next() % 340 + 40,
                  rand.Next() % 340 + 6000,
                  rand.Next() % 340 + 60,
                  rand.Next() % 140 + 40,
                  rand.Next() % 140 + 20,
                  rand.Next() % 140 + 40
            };

            for (int i = 0; i < 7; ++i)
            {
                if (tick % (trigger[i]) == 0 && tick > 0)
                {
                    GameObjects.AddItem(new ItemEntity(new Point2D((rand.Next() % (460 - GameResources.GameImage("Item" + items[i].ToString()).Width)) + 40, 50), items[i]));
                }
            }

            if (tick % (rand.Next() % 80 + 50) == 0 && tick > 0)
            {
                double x = rand.Next() % 460 + 40;
                double y = rand.Next() % 460 + 40;
                int    n = rand.Next() % 24;
                for (int j = 0; j < n; ++j)
                {
                    GameObjects.AddBullet(new BulletEntity(new Point2D(x, y), new Velocity2D(2.8, 360 / n * j), 360 / n * j, BulletColour.Red, BulletType.Ring, null));
                }
            }
        }
コード例 #2
0
        public void Cannon()
        {
            switch (_playerType)
            {
            case PlayerType.NarrowA:
                switch (_cannonMain)
                {
                case 0:
                    if (Tick % 6 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -90.0), -90.0, BulletColour.Blue, BulletType.Seed, this));
                    }
                    break;

                case 1:
                    if (Tick % 6 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -92.0), -92.0, BulletColour.Blue, BulletType.Seed, this));
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -88.0), -88.0, BulletColour.Blue, BulletType.Seed, this));
                    }
                    break;

                case 2:
                    if (Tick % 6 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -94.0), -94.0, BulletColour.Turquoise, BulletType.Seed, this));
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -90.0), -90.0, BulletColour.Blue, BulletType.Seed, this));
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -86.0), -86.0, BulletColour.Turquoise, BulletType.Seed, this));
                    }
                    break;

                case 3:
                    if (Tick % 6 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -98.0), -98.0, BulletColour.Green, BulletType.Seed, this));
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -94.0), -94.0, BulletColour.Turquoise, BulletType.Seed, this));
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -90.0), -90.0, BulletColour.Blue, BulletType.Seed, this));
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -86.0), -86.0, BulletColour.Turquoise, BulletType.Seed, this));
                        GameObjects.AddBullet(new BulletEntity(Position, new Velocity2D(8.0, -82.0), -82.0, BulletColour.Green, BulletType.Seed, this));
                    }
                    break;
                }
                switch (_cannonAux)
                {
                case 1:
                    if (Tick % 24 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 32, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Purple, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 32, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Purple, BulletType.Star, this));
                    }
                    break;

                case 2:
                    if (Tick % 36 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 32, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Purple, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 32, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Purple, BulletType.Star, this));
                    }
                    if ((Tick + 18) % 36 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 28, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Red, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 28, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Red, BulletType.Star, this));
                    }
                    break;

                case 3:
                    if (Tick % 24 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 32, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Purple, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 32, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Purple, BulletType.Star, this));
                    }
                    if ((Tick + 12) % 24 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 28, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Red, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 28, Y), new Velocity2D(5.8, -90.0), -90.0, BulletColour.Red, BulletType.Star, this));
                    }
                    break;

                case 4:
                    if (Tick % 24 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 32, Y), new Velocity2D(5.8, -92.0), -92.0, BulletColour.Purple, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 32, Y), new Velocity2D(5.8, -88.0), -88.0, BulletColour.Purple, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 32, Y), new Velocity2D(5.8, -92.0), -92.0, BulletColour.Red, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 32, Y), new Velocity2D(5.8, -88.0), -88.0, BulletColour.Red, BulletType.Star, this));
                    }
                    if ((Tick + 12) % 24 == 0)
                    {
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 28, Y), new Velocity2D(5.8, -92.0), -92.0, BulletColour.Purple, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 28, Y), new Velocity2D(5.8, -88.0), -88.0, BulletColour.Purple, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X + 28, Y), new Velocity2D(5.8, -92.0), -92.0, BulletColour.Red, BulletType.Star, this));
                        GameObjects.AddBullet(new BulletEntity(new Point2D(X - 28, Y), new Velocity2D(5.8, -88.0), -88.0, BulletColour.Red, BulletType.Star, this));
                    }
                    break;
                }
                break;

            case PlayerType.NarrowB:
                break;

            case PlayerType.WideA:
                break;

            case PlayerType.WideB:
                break;
            }
        }