Exemple #1
0
 public Game(String name, int width, int height, Point location)
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     this.Width          = width;
     this.Height         = height;
     this.Location       = location;
     flagMove            = false;
     flagPaused          = false;
     gd = new GameDoc(name, width, height, pnlStatus.Height);
     timer1.Start();
     timer2.Start();
     FileName  = null;
     flagUp    = false;
     flagDown  = false;
     flagLeft  = false;
     flagRight = false;
     r         = new Random();
     gd.time   = lblTime.Text;
     gd.addDemon(this.Width, this.Height, r);
     axwmp.URL = Path.Combine(System.IO.Path.GetFullPath(@"..\..\"), "Resources\\09 - SsSsSsSsSsSsSsSsSs - ingame.mp3");
     axwmp.settings.setMode("loop", true);
     axwmp.Ctlcontrols.play();
     pewplayer = new System.Media.SoundPlayer(Properties.Resources.pew);
     Invalidate(true);
 }
Exemple #2
0
 public Game(String name, int width, int height, Point location)
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     this.Width          = width;
     this.Height         = height;
     this.Location       = location;
     flagMove            = false;
     flagPaused          = false;
     gd = new GameDoc(name, width, height, pnlStatus.Height);
     timer1.Start();
     timer2.Start();
     FileName  = null;
     flagUp    = false;
     flagDown  = false;
     flagLeft  = false;
     flagRight = false;
     r         = new Random();
     gd.addDemon(this.Width, this.Height, r);
     Invalidate(true);
 }
Exemple #3
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            lblTime.Text = gd.time;
            String[] ss   = lblTime.Text.Split(':');
            int      mins = int.Parse(ss[0]);
            int      secs = int.Parse(ss[1]);

            if (secs == 0)
            {
                if (mins > 0)
                {
                    mins--;
                    secs = 59;
                }
            }
            else
            {
                secs--;
            }
            lblTime.Text = mins.ToString("00") + ":" + secs.ToString("00");
            gd.time      = lblTime.Text;
            if (mins == 6)
            {
                if (secs % 5 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 8 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 5)
            {
                if (secs % 4 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 6 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 4)
            {
                if (secs % 5 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 3 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 3)
            {
                if (secs % 4 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 2 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 2)
            {
                if (secs % 3 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                gd.addDemon(this.Width, this.Height, r);
            }

            if (mins == 1)
            {
                if (secs % 2 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                gd.addDemon(this.Width, this.Height, r);
            }

            if (mins == 0)
            {
                gd.addDemon(this.Width, this.Height, r);
                gd.addDemon(this.Width, this.Height, r);
            }

            if (mins == 1 && secs == 0)
            {
                gd.portal.show();
            }
            if (mins == 0 && secs == 30)
            {
                gd.portal.open();
            }
            if (mins == 0 && secs == 0)
            {
                gameLose();
            }

            gd.timePowerUps();
            if (gd.player.timePowerUp())
            {
                if (pbReload.Value >= 50)
                {
                    pbReload.Value = 50;
                }
                pbReload.Maximum = 50;
            }
            else
            {
                pbReload.Maximum   = 100;
                pbReload.ForeColor = Color.DarkOrange;
            }


            if (secs % 15 == 0)
            {
                if (r.Next(10) < 4)
                {
                    gd.addPowerUp(this.Width, this.Height, pnlStatus.Height, r);
                }
            }
        }
Exemple #4
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            String[] ss   = lblTime.Text.Split(':');
            int      mins = int.Parse(ss[0]);
            int      secs = int.Parse(ss[1]);

            if (secs == 0)
            {
                if (mins > 0)
                {
                    mins--;
                    secs = 59;
                }
            }
            else
            {
                secs--;
            }
            lblTime.Text = mins.ToString("00") + ":" + secs.ToString("00");
            if (mins == 6)
            {
                if (secs % 5 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 8 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 5)
            {
                if (secs % 4 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 6 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 4)
            {
                if (secs % 5 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 3 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 3)
            {
                if (secs % 4 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                if (secs % 2 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
            }

            if (mins == 2)
            {
                if (secs % 3 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                gd.addDemon(this.Width, this.Height, r);
            }

            if (mins == 1)
            {
                if (secs % 2 == 0)
                {
                    gd.addDemon(this.Width, this.Height, r);
                }
                gd.addDemon(this.Width, this.Height, r);
            }

            if (mins == 0)
            {
                gd.addDemon(this.Width, this.Height, r);
                gd.addDemon(this.Width, this.Height, r);
            }

            if (mins == 1 && secs == 0)
            {
                gd.portal.show();
            }
            if (mins == 0 && secs == 30)
            {
                gd.portal.open();
            }
            if (mins == 0 && secs == 0)
            {
                gameLose();
            }
        }