Example #1
0
        public Congrats()
        {
            InitializeComponent();

            ScreenControl.setComponentValues(this);
            defaultOverride();
        }
Example #2
0
        /// <summary>
        /// Open the pause dialog box and gets Cancel or Abort result from it
        /// </summary>
        private void pauseGame()
        {
            buttonClick.Play();
            gameTimer2.Enabled = false;
            rightArrowDown     = leftArrowDown = upArrowDown = downArrowDown = false;

            DialogResult result = Dialogs.PauseDialog.Show();

            if (result == DialogResult.Cancel)
            {
                buttonClick.Play();
                gameTimer2.Enabled = true;
            }
            if (result == DialogResult.Abort)
            {
                buttonClick.Play();
                ScreenControl.changeScreen(this, "MenuScreen");
            }
        }
Example #3
0
 private void menuButton2_Enter(object sender, EventArgs e)
 {
     buttonClick.Play();
     ScreenControl.changeScreen(this, "menuScreen");
 }
Example #4
0
 //change screen
 private void menu2_Click(object sender, EventArgs e)
 {
     ScreenControl.changeScreen(this, "MenuScreen");
 }
Example #5
0
 //change screen to menu
 private void button1_Click(object sender, EventArgs e)
 {
     ScreenControl.changeScreen(this, "CasesScreen");
 }
Example #6
0
 private void button9_Click(object sender, EventArgs e)
 {
     buttonDown = 9;
     ScreenControl.changeScreen(this, "AnimationScreen");
     buttonvisible.button9 = false;
 }
Example #7
0
        /// <summary>
        /// All game update logic must be placed in this event method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gameTimer2_Tick(object sender, EventArgs e)
        {
            //SoundPlayer duringGame = new SoundPlayer(Properties.Resources.duringGame);
            //duringGame.Play();
            #region main character movements
            if (leftArrowDown == true)
            {
                redRecX--;
            }
            if (downArrowDown == true)
            {
                redRecY++;
            }
            if (rightArrowDown == true)
            {
                redRecX++;
            }
            if (upArrowDown == true)
            {
                redRecY--;
            }
            #endregion
            #region Blue Circle Movements
            for (int i = 0; i < yBluOb.Count; i++)
            {
                if (directionb == "down")
                {
                    yBluOb[i] += 6;
                }
                else
                {
                    yBluOb[i] -= 6;
                }
            }
            if (yBluOb[0] > 318)
            {
                directionb = "up";
            }
            if (yBluOb[yBluOb.Count - 1] < 238)
            {
                directionb = "down";
            }
            for (int i = 0; i < yBluOt.Count; i++)
            {
                if (directiont == "down")
                {
                    xBluOt[i] += 6;
                }
                else
                {
                    xBluOt[i] -= 6;
                }
            }
            if (yBluOt[0] > 318)
            {
                directiont = "up";
            }
            if (yBluOt[yBluOt.Count - 1] < 238)
            {
                directiont = "down";
            }

            #endregion
            #region collision detection
            Rectangle redRec = new Rectangle(redRecX, redRecY, size, size);
            for (int i = 0; i < xBluOb.Count; i++)
            {
                Rectangle recBluOb = new Rectangle(xBluOb[i], yBluOb[i], size, size);
                if (recBluOb.IntersectsWith(redRec))
                {
                    redRecX = 267;
                    redRecY = 322;
                    deaths++;
                }
            }
            for (int i = 0; i < xBluOt.Count; i++)
            {
                Rectangle recBluOt = new Rectangle(xBluOt[i], yBluOt[i], size, size);
                if (recBluOt.IntersectsWith(redRec))
                {
                    redRecX = 267;
                    redRecY = 322;
                    deaths++;
                }
            }
            Rectangle lineRec1 = new Rectangle(xA, yB, line, byTwo);
            if (lineRec1.IntersectsWith(redRec))
            {
                redRecX++;
            }
            Rectangle lineRec2 = new Rectangle(xA, yB, byThree, line);
            if (lineRec2.IntersectsWith(redRec))
            {
                redRecY++;
            }
            Rectangle lineRec3 = new Rectangle(xB, yA, line, byTwo);
            if (lineRec3.IntersectsWith(redRec))
            {
                redRecX++;
            }
            Rectangle lineRec4 = new Rectangle(xB, yA, length, line);
            if (lineRec4.IntersectsWith(redRec))
            {
                redRecY++;
            }
            Rectangle lineRec5 = new Rectangle(xC, yA, line, byTwo);
            if (lineRec5.IntersectsWith(redRec))
            {
                redRecX--;
            }
            Rectangle lineRec6 = new Rectangle(xC, yB, byThree, line);
            if (lineRec6.IntersectsWith(redRec))
            {
                redRecY++;
            }
            Rectangle lineRec7 = new Rectangle(xC, yD, line, byTwo);
            if (lineRec7.IntersectsWith(redRec))
            {
                redRecX--;
            }
            Rectangle lineRec8 = new Rectangle(xC, yB, byThree, line);
            if (lineRec8.IntersectsWith(redRec))
            {
                redRecY--;
            }
            Rectangle lineRec9 = new Rectangle(xC, yC, line, byTwo);
            if (lineRec9.IntersectsWith(redRec))
            {
                redRecX--;
            }
            Rectangle lineRec10 = new Rectangle(xB, yD, length, line);
            if (lineRec10.IntersectsWith(redRec))
            {
                redRecY--;
            }
            Rectangle lineRec11 = new Rectangle(xB, yC, line, byTwo);
            if (lineRec11.IntersectsWith(redRec))
            {
                redRecX++;
            }
            Rectangle lineRec12 = new Rectangle(xA, yC, byThree, line);
            if (lineRec12.IntersectsWith(redRec))
            {
                redRecY--;
            }
            Rectangle yellCirc = new Rectangle(xYellO, yYellO, size, size);
            if (yellCirc.IntersectsWith(redRec))
            {
                yellO++;
                yellowO.Play();
            }
            Rectangle greenRec = new Rectangle(xC, yB, byThree, byTwo);
            if (greenRec.IntersectsWith(redRec) && yellO == 1)
            {
                gameTimer2.Stop();
                ScreenControl.changeScreen(this, "Congrats");
            }
            #endregion

            //refresh the screen, which causes the GameScreen_Paint method to run
            Refresh();
        }