Exemple #1
0
        void GameInitialization()
        {
            direction           = 0;
            label1.Text         = "0";
            _check[0]           = false;
            _check[1]           = false;
            enemytimer.Interval = 300;
            enemytimer.Tick    -= T_Tick;
            enemytimer.Tick    += T_Tick;

            pacmantimer.Interval = 100;
            pacmantimer.Tick    -= Pacmantimer_Tick;
            pacmantimer.Tick    += Pacmantimer_Tick;

            pack  = new Characters.Pacman(ref dots, ref blocks);
            enemy = new Characters.Enemy(pack, ref blocks);

            pack.Pacman_PointsChanged += new
                                         Characters.Pacman_PointsChanged(pack_Pacman_PointsChanged);
            pack.Pacman_Messages += new
                                    Characters.Pacman_Messages(pack_Pacman_Messages);

            pack.Location  = new Point(100, 100);
            enemy.Location = new Point(440, 100);

            this.PacmanGroupBox.Controls.Add(pack);
            this.PacmanGroupBox.Controls.Add(enemy);

            LoadDots();
            LoadBlocks();
            enemytimer.Start();
            pacmantimer.Start();
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //la réinitialisation devrait réafficher la scéne d origine comment?
            this.PacmanGroupBox.Controls.Clear();
            ucScene11 = new UCScene1();
            this.PacmanGroupBox.Controls.Add(ucScene11);
            if (ucScene11.Controls.OfType <Characters.Pacman>().ToArray().Count() == 0)
            {
                MessageBox.Show("La scéne n'ets pas valide il vous faut un pacman!");
                return;
            }
            pacman = ucScene11.Controls.OfType <Characters.Pacman>().ToArray().First();
            enemy  = ucScene11.Controls.OfType <Characters.Enemy>().ToArray().First();
            Characters.Dots[]  dots   = ucScene11.Controls.OfType <Characters.Dots>().ToArray();
            Characters.Block[] blocks = ucScene11.Controls.OfType <Characters.Block>().ToArray();
            pacman?.Initialize(ref dots, ref blocks);
            enemy?.Initialize(pacman);

            if (pacman != null)
            {
                pacman.Pacman_PointsChanged += new Characters.Pacman_PointsChanged(pack_Pacman_PointsChanged);
                pacman.Pacman_Messages      += new Characters.Pacman_Messages(pack_Pacman_Messages);
                pacman.TotalPoints           = 0;
            }
        }
Exemple #3
0
        void GameInitialization()
        {
            Characters.Pacman pack = new Characters.Pacman(ref dots, ref blocks);
            pack.Pacman_PointsChanged += new Characters.Pacman_PointsChanged(pack_Pacman_PointsChanged);
            pack.Pacman_Messages      += new Characters.Pacman_Messages(pack_Pacman_Messages);
            pack.Location              = new Point(100, 100);

            Characters.Enemy enemy = new Characters.Enemy(pack);
            enemy.Location = new Point(200, 200);

            this.PacmanGroupBox.Controls.Add(pack);
            this.PacmanGroupBox.Controls.Add(enemy);

            LoadDots();
            LoadBlocks();
        }
Exemple #4
0
        public virtual void Catched(Enemy sender)
        {
            Graphics g = this.CreateGraphics();

            g.FillEllipse(System.Drawing.Brushes.Red, 0, 0, Width, Height);
            g.FillEllipse(System.Drawing.Brushes.Black, 20, 10, 5, 5);
            g.FillEllipse(System.Drawing.Brushes.Transparent, 35, 20, 10, 5);

            _Catched = true;

            if (Pacman_Messages != null)
                Pacman_Messages(this, "Pacman has been catched by an enemy.");
        }