Exemplo n.º 1
0
        public _2Player()
        {
            InitializeComponent();

            // set the banner
            LevelBanner = Properties.Resources.two_player;

            base.CoreBuild();

            // add the obstacles
            engine.obstacles.Add(Obstacle.FromPicture(obstacle1, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle2, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle3, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle4, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle5, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle6, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle7, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle8, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle9, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle10, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle11, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle12, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle13, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle14, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle15, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle16, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle17, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle18, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle19, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle20, Color.Brown));
            engine.obstacles.Add(Obstacle.FromPicture(obstacle21, Color.Brown));
            // add the snakes
            snake = new ContinuousSnake(spawnPoint.Location.X, spawnPoint.Location.Y, this, new Vector(3, 90), 3, false);
            engine.AddSnake(snake);
            // add the red snake
            snakeRed = new ContinuousSnake(spawnPointRed.Location.X, spawnPointRed.Location.Y, this, new Vector(3, 90), 3, true);
            engine.AddSnake(snakeRed);

            // make the spawnpoints invisible
            spawnPoint.Visible    = false;
            spawnPointRed.Visible = false;

            // add the food spawners to a single spawn group
            FoodSpawnGroup spawnGroup = new FoodSpawnGroup(engine, 0.9);

            spawnGroup.Add(new AppleSpawnPad(applespawn1, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn2, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn3, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn4, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn5, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn6, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn7, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn8, 1, engine));
            spawnGroup.Add(new AppleSpawnPad(applespawn9, 1, engine));
            // add it to the engine
            engine.AddFoodGroupSpawner(spawnGroup);
        }
Exemplo n.º 2
0
 void AddObstacles() // get all picturebox obstacles in the form and register them as obstacles
 {
     engine.AddObstacle(Obstacle.FromPicture(obstacle1, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle2, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle3, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle4, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle5, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle6, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle7, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle8, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle9, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle10, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle11, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle12, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle13, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle14, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle15, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle16, Color.Brown));
 }
Exemplo n.º 3
0
        // create objects in the form (coins, obstacles)
        void gameConstruction()
        {
            // make the paused banner
            pausedBanner = new PictureBox
            {
                Image = Properties.Resources.paused,
                // resize box to fit image
                SizeMode = PictureBoxSizeMode.AutoSize
            };
            pausedBanner.Location = new Point((Width - pausedBanner.Width) / 2, (Height - pausedBanner.Height) / 2); // center the image
            // create the game engine
            engine = new GameEngine(this);
            // add existent coins
            engine.AddFood(new Apple(coin1, this));
            engine.AddFood(new Apple(coin2, this));
            engine.AddFood(new Apple(coin3, this));
            engine.AddFood(new Apple(coin4, this));
            engine.AddFood(new Apple(coin5, this));
            engine.AddFood(new Apple(coin6, this));
            engine.AddFood(new Apple(coin7, this));


            // add obstacles existent on the map
            engine.AddObstacle(Obstacle.FromPicture(obstacle1, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle2, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle3, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle4, Color.Red));
            // create and add food spawner group
            FoodSpawnGroup group = new FoodSpawnGroup(engine);

            group.Add(new AppleSpawnPad(spawnPadPic2, 0.00001, engine));
            group.Add(new AppleSpawnPad(spawnPadPic, 0.00001, engine)); // add the second spawner
            engine.groupSpawners.Add(group);

            // Add enemies
            engine.AddStationary(new EnemyStationary(enemy1, 16, this));

            // make a new snake
            snake = new ContinuousSnake(Size.Width / 2, Size.Height / 2, this, new Vector(2, 90), 300);
            // add it to the engine
            engine.AddSnake(snake);
        }
Exemplo n.º 4
0
 void AddObstacles() // add all obstacles in this level
 {
     engine.AddObstacle(Obstacle.FromPicture(obstacle1, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle2, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle3, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle4, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle5, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle6, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle7, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle8, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle9, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle10, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle11, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle12, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle13, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle14, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle15, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle16, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle17, Color.Brown));
 }
Exemplo n.º 5
0
        public override void gameConstruction()
        {
            // set the level banner
            LevelBanner = Properties.Resources.Level_Boss;
            base.gameConstruction();

            // rotate gate image and add it
            Image gateImg = Properties.Resources.Gate;

            gateImg.RotateFlip(RotateFlipType.Rotate270FlipXY);
            Gate.Image    = gateImg;
            Gate.SizeMode = PictureBoxSizeMode.StretchImage;

            // add obstacles
            engine.AddObstacle(Obstacle.FromPicture(obstacle1, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle2, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle3, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle4, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle5, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle6, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle7, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle8, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle9, Color.Brown));
            engine.AddObstacle(Obstacle.FromPicture(obstacle10, Color.Brown));

            boss = new Boss(bossPic, 100, 8000, this); // create the boss
            // add the snake
            snake = new ContinuousSnake(spawnPoint.Location.X, spawnPoint.Location.Y, this, new Vector(3, 90), 3);
            engine.AddSnake(snake);               // register the snake with the engine

            engine.gate_collider = gate_collider; // add the gate collider

            // add the apple spawn pads
            engine.AddFoodSpawner(new AppleSpawnPad(applespawnpad1, 0.5, engine));
            engine.AddFoodSpawner(new AppleSpawnPad(applespawnpad2, 0.5, engine));
            engine.AddFoodSpawner(new AppleSpawnPad(applespawnpad3, 0.5, engine));

            // make the spawn point invisible
            spawnPoint.Visible = false;
        }
Exemplo n.º 6
0
 void AddObstacles()
 {
     engine.AddObstacle(Obstacle.FromPicture(obstacle1, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle2, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle3, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle4, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle5, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle6, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle7, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle8, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle9, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle10, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle11, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle12, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle13, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle14, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle15, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle16, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle17, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle18, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle19, Color.Brown));
     engine.AddObstacle(Obstacle.FromPicture(obstacle20, Color.Brown));
 }