예제 #1
0
        public void Initialize()
        {
            backgroundTexture = Game1.backgroundTexture2;
            grassTexture = Game1.grassTexture;

            gun = new Gun();

            platforms = new List<Platform>();
            Platform platform = new Platform();
            Platform platform2 = new Platform();
            Platform platform3 = new Platform();
            Platform platform4 = new Platform();
            Platform platform5 = new Platform();
            Platform platform6 = new Platform();
            Platform platform7 = new Platform();
            Platform platform8 = new Platform();
            Platform platform9 = new Platform();
            Platform platform10 = new Platform();
            platforms.Add(platform);
            platforms.Add(platform2);
            platforms.Add(platform3);
            platforms.Add(platform4);
            platforms.Add(platform5);
            platforms.Add(platform6);
            platforms.Add(platform7);
            platforms.Add(platform8);
            platforms.Add(platform9);
            platforms.Add(platform10);

            platforms[0].Initialize(grassTexture);
            platforms[1].Initialize(grassTexture);
            platforms[2].Initialize(grassTexture);
            platforms[3].Initialize(grassTexture);
            platforms[4].Initialize(grassTexture);
            platforms[5].Initialize(grassTexture);
            platforms[6].Initialize(grassTexture);
            platforms[7].Initialize(grassTexture);
            platforms[8].Initialize(grassTexture);
            platforms[9].Initialize(grassTexture);

            startPosPlat = new Vector2[10] { new Vector2(233, 380), new Vector2(150, 290), new Vector2(350, 330),
                new Vector2(100, 430), new Vector2(-100, 250), new Vector2(600, 350), new Vector2(200, 200),
                new Vector2(200, 150), new Vector2(200, 100), new Vector2(200, 50) }; // Begin posities voor respawnen
            platform.boundingBox = new Rectangle((int)startPosPlat[0].X, (int)startPosPlat[0].Y, 334, 100);
            platform2.boundingBox = new Rectangle((int)startPosPlat[1].X, (int)startPosPlat[1].Y, 100, 10);
            platform3.boundingBox = new Rectangle((int)startPosPlat[2].X, (int)startPosPlat[2].Y, 300, 15);
            platform4.boundingBox = new Rectangle((int)startPosPlat[3].X, (int)startPosPlat[3].Y, 50, 10);
            platform5.boundingBox = new Rectangle((int)startPosPlat[4].X, (int)startPosPlat[4].Y, 300, 10);
            platform6.boundingBox = new Rectangle((int)startPosPlat[5].X, (int)startPosPlat[5].Y, 300, 10);
            platform7.boundingBox = new Rectangle((int)startPosPlat[6].X, (int)startPosPlat[6].Y, 100, 10);
            platform8.boundingBox = new Rectangle((int)startPosPlat[7].X, (int)startPosPlat[7].Y, 100, 10);
            platform9.boundingBox = new Rectangle((int)startPosPlat[8].X, (int)startPosPlat[8].Y, 100, 10);
            platform10.boundingBox = new Rectangle((int)startPosPlat[9].X, (int)startPosPlat[9].Y, 100, 10);

            Character.bounds = new Rectangle(300, 280, 80, 80);
        }
예제 #2
0
        public void Initialize()
        {
            backgroundTexture = Game1.backgroundTexture2;
            grassTexture = Game1.grassTexture;
            enemyTexture1 = Game1.enemyTexture1;
            enemyTexture2 = Game1.enemyTexture2;
            enemyTexture3 = Game1.enemyTexture3;
            gunTexture = Game1.gunTexture;

            gun = new Gun();
            gun.Initialize(gunTexture, new Rectangle(500, 320, 20, 20));

            enemies = new List<Enemy>();
            enemies.Clear();
            Enemy enemy1 = new Enemy();
            Enemy enemy2 = new Enemy();
            //Enemy enemy3 = new Enemy();
            enemies.Add(enemy1);
            enemies.Add(enemy2);
            //enemies.Add(enemy3);

            enemies[0].Initialize(enemyTexture1, new Rectangle(330, 260, 75, 55), 2); //Texture en (positie, grootte)
            enemies[1].Initialize(enemyTexture2, new Rectangle(-150, 80, 170, 140), 5);
            //enemies[2].Initialize(enemyTexture3, new Rectangle(380, 260, 22, 33));

            platforms = new List<Platform>();
            platforms.Clear();
            Platform platform = new Platform();
            Platform platform2 = new Platform();
            Platform platform3 = new Platform();
            Platform platform4 = new Platform();
            Platform platform5 = new Platform();
            Platform platform6 = new Platform();
            Platform platform7 = new Platform();
            Platform platform8 = new Platform();
            Platform platform9 = new Platform();
            Platform platform10 = new Platform();
            platforms.Add(platform);
            platforms.Add(platform2);
            platforms.Add(platform3);
            platforms.Add(platform4);
            platforms.Add(platform5);
            platforms.Add(platform6);
            platforms.Add(platform7);
            platforms.Add(platform8);
            platforms.Add(platform9);
            platforms.Add(platform10);

            platforms[0].Initialize(grassTexture);
            platforms[1].Initialize(grassTexture);
            platforms[2].Initialize(grassTexture);
            platforms[3].Initialize(grassTexture);
            platforms[4].Initialize(grassTexture);
            platforms[5].Initialize(grassTexture);
            platforms[6].Initialize(grassTexture);
            platforms[7].Initialize(grassTexture);
            platforms[8].Initialize(grassTexture);
            platforms[9].Initialize(grassTexture);

            startPosPlat = new Vector2[10] { new Vector2(233, 380), new Vector2(150, 290), new Vector2(350, 330),
                new Vector2(100, 430), new Vector2(-100, 250), new Vector2(600, 350), new Vector2(200, 200),
                new Vector2(200, 150), new Vector2(200, 100), new Vector2(200, 50) }; // Begin posities voor respawnen
            platform.boundingBox = new Rectangle((int)startPosPlat[0].X, (int)startPosPlat[0].Y, 334, 100);
            platform2.boundingBox = new Rectangle((int)startPosPlat[1].X, (int)startPosPlat[1].Y, 100, 10);
            platform3.boundingBox = new Rectangle((int)startPosPlat[2].X, (int)startPosPlat[2].Y, 300, 15);
            platform4.boundingBox = new Rectangle((int)startPosPlat[3].X, (int)startPosPlat[3].Y, 50, 10);
            platform5.boundingBox = new Rectangle((int)startPosPlat[4].X, (int)startPosPlat[4].Y, 300, 10);
            platform6.boundingBox = new Rectangle((int)startPosPlat[5].X, (int)startPosPlat[5].Y, 300, 10);
            platform7.boundingBox = new Rectangle((int)startPosPlat[6].X, (int)startPosPlat[6].Y, 100, 10);
            platform8.boundingBox = new Rectangle((int)startPosPlat[7].X, (int)startPosPlat[7].Y, 100, 10);
            platform9.boundingBox = new Rectangle((int)startPosPlat[8].X, (int)startPosPlat[8].Y, 100, 10);
            platform10.boundingBox = new Rectangle((int)startPosPlat[9].X, (int)startPosPlat[9].Y, 100, 10);

            Character.bounds = new Rectangle(300, 280, 80, 80);
        }
예제 #3
0
        public void Initialize()
        {
            backgroundTexture = Game1.backgroundTexture2;
            grassTexture = Game1.grassTexture;
            baseTexture = Game1.baseTexture;
            cloudTexture = Game1.cloudTexture;
            enemyTexture2 = Game1.enemyTexture2;
            enemyTexture3 = Game1.enemyTexture3;
            gunTexture = Game1.gunTexture;

            gun = new Gun();
            gun.Initialize(gunTexture, new Rectangle(-320, -170, 20, 20));

            platforms = new List<Platform>();
            platforms.Clear();

            // Lijst met posities van platformen
            startDimPlat = new List<Rectangle>();

            startDimPlat.Add(new Rectangle(-300, 350, 1800, 350)); // Huge platform //0
            startDimPlat.Add(new Rectangle(600, 250, 100, 60)); //1
            startDimPlat.Add(new Rectangle(1200, 250, 100, 60)); //2
            startDimPlat.Add(new Rectangle(1650, 340, 100, 60)); //3
            startDimPlat.Add(new Rectangle(750, 150, 400, 100)); // Groot platform onder //4
            startDimPlat.Add(new Rectangle(800, 50, 90, 40)); //5
            startDimPlat.Add(new Rectangle(905, 50, 90, 40)); //6
            startDimPlat.Add(new Rectangle(1020, 50, 90, 40)); //7
            startDimPlat.Add(new Rectangle(700, -50, 500, 50)); // Groot platform boven //8
            startDimPlat.Add(new Rectangle(475, -130, 100, 20)); // Wolk begin //9
            startDimPlat.Add(new Rectangle(180, -140, 100, 20)); //10
            startDimPlat.Add(new Rectangle(-50, -150, 100, 20)); //11
            startDimPlat.Add(new Rectangle(-330, -160, 100, 20)); // Wolk einde //12
            startDimPlat.Add(new Rectangle(1900, 340, 100, 100)); //13
            startDimPlat.Add(new Rectangle(2150, 430, 120, 100)); //14
            startDimPlat.Add(new Rectangle(2480, 500, 250, 100)); //15
            startDimPlat.Add(new Rectangle(2780, 550, 1000, 350)); //16 //tweede huge platform

            // Platformen aanmaken
            for (int i = 0; i < startDimPlat.Count; i++)
            {
                Platform platform = new Platform();
                platforms.Add(platform);
            }

            // Platformen texture geven
            for (int i = 0; i < platforms.Count; i++)
                platforms[i].Initialize(grassTexture);

            platforms[0].Initialize(baseTexture);
            platforms[9].Initialize(cloudTexture);
            platforms[10].Initialize(cloudTexture);
            platforms[11].Initialize(cloudTexture);
            platforms[12].Initialize(cloudTexture);
            platforms[16].Initialize(baseTexture);
            platforms[16].Initialize(baseTexture);

            // Platformen posities geven
            for (int i = 0; i < platforms.Count; i++)
                platforms[i].boundingBox = startDimPlat[i];

            goalPos = new Vector2(3700, 430);

            // Muntjes
            startPosCoins = new List<Vector2>();

            startPosCoins.Add(new Vector2(763, 112));
            startPosCoins.Add(new Vector2(813, 112));
            startPosCoins.Add(new Vector2(863, 112));
            startPosCoins.Add(new Vector2(913, 112));
            startPosCoins.Add(new Vector2(963, 112));
            startPosCoins.Add(new Vector2(1013, 112));
            startPosCoins.Add(new Vector2(1063, 112));
            startPosCoins.Add(new Vector2(1113, 112));
            startPosCoins.Add(new Vector2(1950, 310));
            startPosCoins.Add(new Vector2(2220, 400));
            startPosCoins.Add(new Vector2(2510, 470));
            startPosCoins.Add(new Vector2(3060, 510));

            coins = new List<coins>();

            for (int i = 0; i < startPosCoins.Count; i++)
            {
                coins coin = new coins(game);
                coins.Add(coin);
            }

            for (int i = 0; i < coins.Count; i++)
                coins[i].position = startPosCoins[i];

            enemies = new List<Enemy>();
            enemies.Clear();
            Enemy enemy1 = new Enemy();
            Enemy enemy2 = new Enemy();
            Enemy enemy3 = new Enemy();
            Enemy enemy4 = new Enemy();
            Enemy enemy5 = new Enemy();
            Enemy enemy6 = new Enemy();
            Enemy enemy7 = new Enemy();
            Enemy enemy8 = new Enemy();
            Enemy enemy9 = new Enemy();
            Enemy enemy10 = new Enemy();

            enemies.Add(enemy1);
            enemies.Add(enemy2);
            enemies.Add(enemy3);
            enemies.Add(enemy4);
            enemies.Add(enemy5);
            enemies.Add(enemy6);
            enemies.Add(enemy7);
            enemies.Add(enemy8);
            enemies.Add(enemy9);
            enemies.Add(enemy10);

            enemies[0].Initialize(enemyTexture3, new Rectangle(800, -100, 46, 34), 1); //Texture en (positie, grootte)
            enemies[1].Initialize(enemyTexture3, new Rectangle(850, -100, 46, 34), 1);
            enemies[2].Initialize(enemyTexture3, new Rectangle(900, -100, 46, 34), 1);
            enemies[3].Initialize(enemyTexture3, new Rectangle(-150, 260, 93, 69), 2);
            enemies[4].Initialize(enemyTexture3, new Rectangle(800, 280, 93, 69), 2);
            enemies[5].Initialize(enemyTexture3, new Rectangle(450, 280, 46, 34), 1);
            enemies[6].Initialize(enemyTexture3, new Rectangle(520, 280, 46, 34), 1);
            enemies[7].Initialize(enemyTexture3, new Rectangle(590, 280, 46, 34), 1);
            enemies[8].Initialize(enemyTexture3, new Rectangle(1000, 190, 93, 69), 2);
            enemies[9].Initialize(enemyTexture2, new Rectangle(3500, 300, 192, 192), 10);

            Character.bounds = new Rectangle(300, 280, 80, 80);
        }