Esempio n. 1
0
        /// <summary>
        /// Create the common base of each levels
        /// </summary>
        private void CreateBaseInterface()
        {
            try
            {
                this.bw_move.RunWorkerAsync();
                this.bw_action.RunWorkerAsync();
                this.bw_animation.RunWorkerAsync();
                this.bw_delay.RunWorkerAsync();
            }
            catch
            {
            }

            this.bw_move.DoWork      += new DoWorkEventHandler(tmrMain_Tick);
            this.bw_action.DoWork    += new DoWorkEventHandler(tmrAction_Tick);
            this.bw_animation.DoWork += new DoWorkEventHandler(tmrAnimations_Tick);
            this.bw_delay.DoWork     += new DoWorkEventHandler(tmrDelays_Tick);
            inGame  = true;
            endDoor = new Doors(1, false, DoorsOutputs.Level1);
            //Création des vies;
            PictureBox pbLifes1 = new PictureBox();
            PictureBox pbLifes2 = new PictureBox();
            PictureBox pbLifes3 = new PictureBox();

            //Initialisation des sprites de vies du player
            CreatePB(pbLifes1, "pbLifes1", 55, 50, 50, 40, Application.StartupPath + @"\res\heart.full.png", "lifes");
            CreatePB(pbLifes2, "pbLifes2", 55, 50, 105, 40, Application.StartupPath + @"\res\heart.full.png", "lifes");
            CreatePB(pbLifes3, "pbLifes3", 55, 50, 160, 40, Application.StartupPath + @"\res\heart.full.png", "lifes");
            //Initialisation du sprite du player
            CreatePB(player, "player", 70, 70, 180, 300, Application.StartupPath + @"\res\blocker.happy.png", "player");
            //Initialisation de la porte de sortie
            CreatePB(endDoor, "endDoor", 70, 70, 2700, 830, Application.StartupPath + @"\res\door.closed.png", "door");
        }
Esempio n. 2
0
        /// <summary>
        /// Build the level 1 of the game
        /// </summary>
        private void Level1()
        {
            //Instanciation du player et de son sprite
            player = new Players(6);

            CreateBaseInterface();
            //Instanciation des objets du niveau
            //Instanciation des clés
            blueKey = new LevelsKeys(1, false);
            //Instanciation des portes
            endDoor = new Doors(1, false, DoorsOutputs.Level2);
            //Instanciation des piques
            spike = new Spikes();
            //Déclaration et instanciation des sprites du niveau
            //Création des plateforms
            PictureBox pbPlateformBase = new PictureBox();
            PictureBox pbBloc1         = new PictureBox();
            PictureBox pbBloc2         = new PictureBox();

            //Création des portes

            //Initialisation des sprites du niveau
            //Initialisation des sprites de plateformes
            CreatePB(pbPlateformBase, "pbPlateformBase", 3072, 70, 10, 900, Application.StartupPath + @"\res\base.png", "platform");
            CreatePB(pbBloc1, "pbBloc1", 70, 70, 1000, 830, Application.StartupPath + @"\res\stone.broken.1.png", "platform");
            CreatePB(pbBloc2, "pbBloc2", 140, 140, 1140, 760, Application.StartupPath + @"\res\stone.broken.4.png", "platform");
            //Initialisation des sprites de clés
            CreatePB(blueKey, "blueKey", 70, 65, 1300, 830, Application.StartupPath + @"\res\key.blue.png", "key");
            //Initialisation des sprites de porte
        }
Esempio n. 3
0
        /// <summary>
        /// Build the level 2 of the game
        /// </summary>
        private void Level2()
        {
            //Instanciation du player
            player = new Players(6);

            CreateBaseInterface();

            //Instanciation des objets du niveau
            //Instanciation des clés
            blueKey   = new LevelsKeys(1, false);
            redKey    = new LevelsKeys(1, false);
            greenKey  = new LevelsKeys(1, false);
            yellowKey = new LevelsKeys(1, false);
            //Instanciation des portes
            endDoor = new Doors(1, false, DoorsOutputs.Level3);
            //Instanciation des piques
            spike = new Spikes();
            //Instanciation des slims
            Slims slim1 = new Slims(100);
            //Déclaration et instanciation des sprites du niveau
            //Création des plateforms
            PictureBox pbPlateformBase = new PictureBox();
            PictureBox pbBloc1         = new PictureBox();

            //Création des portes
            //Initialisation des sprites du niveau
            //Initialisation des sprites de plateformes
            CreatePB(pbPlateformBase, "pbPlateformBase", 3072, 70, 10, 900, Application.StartupPath + @"\res\base.png", "platform");
            CreatePB(pbBloc1, "pbBloc1", 70, 70, 1000, 830, Application.StartupPath + @"\res\stone.broken.1.png", "platform");
            //Initialisation des sprites de slims
            CreatePB(slim1, "slim1", 40, 40, 2050, 865, Application.StartupPath + @"\res\slime.right.1.png", "slims");
            slims.Add(slim1);
            //Initialisation des sprites de clés
            CreatePB(blueKey, "blueKey", 70, 65, 1300, 830, Application.StartupPath + @"\res\key.blue.png", "key");
            CreatePB(redKey, "redKey", 70, 65, 1380, 830, Application.StartupPath + @"\res\key.red.png", "key");
            CreatePB(greenKey, "greenKey", 70, 65, 1460, 830, Application.StartupPath + @"\res\key.green.png", "key");
            CreatePB(yellowKey, "yellowKey", 70, 65, 1540, 830, Application.StartupPath + @"\res\key.yellow.png", "key");
            //Initialisation des sprites de porte
            //Initialisation des sprites de piques
            CreatePB(spike, "spike1", 70, 75, 1650, 865, Application.StartupPath + @"\res\spikes.png", "spikes");
        }