Exemplo n.º 1
0
        private void pb_refresh_Click(object sender, EventArgs e) // Every click loads Form again
        {
            frm_ManuelGameMod form = new frm_ManuelGameMod();

            Hide();
            form.Show();
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (rb_ManuelMod.Checked == true)
     {
         frm_ManuelGameMod form = new frm_ManuelGameMod();
         Hide();
         form.Show();
     }
     else
     {
         frm_OtomatikGameMod form = new frm_OtomatikGameMod();
         Hide();
         form.Show();
     }
 }
Exemplo n.º 3
0
        private void frm_ManuelGameMod_KeyDown(object sender, KeyEventArgs e)
        {
            if (pb_Pacman.Left < 0 && e.KeyCode == Keys.Left)
            {
                return;
            }
            else if (pb_Pacman.Top < 40 && e.KeyCode == Keys.Up)
            {
                return;
            }
            else if (pb_Pacman.Right > Size.Width - pb_Pacman.Width && e.KeyCode == Keys.Right)
            {
                return;
            }
            else if (pb_Pacman.Bottom > Size.Height - pb_Pacman.Height && e.KeyCode == Keys.Down)
            {
                return;
            }

            switch (e.KeyCode)
            {
            case Keys.Up:
                pb_Pacman.Top -= 20;
                break;

            case Keys.Right:
                pb_Pacman.Left += 20;
                break;

            case Keys.Down:
                pb_Pacman.Top += 20;
                break;

            case Keys.Left:
                pb_Pacman.Left -= 20;
                break;

            default:
                break;
            }

            CatchControl(); // my catch control function.

            if (pb_target1.Visible == false && pb_target2.Visible == false && pb_target3.Visible == false && pb_target4.Visible == false && pb_target5.Visible == false)
            {
                DialogResult result = MessageBox.Show("You collected all targets. Do you want to play again?",
                                                      "Well done!",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    frm_ManuelGameMod form = new frm_ManuelGameMod();
                    Hide();
                    form.Show();
                }
                else
                {
                    frm_StartGame form = new frm_StartGame();
                    Hide();
                    form.Show();
                }
            }
        }