Example #1
0
        private bool InitGame()
        {
            //int mth = Imports.LLr();
            //MessageBox.Show(mth.ToString());
            //mth = IntPtr.Zero;

            UserData user = new UserData();

            if (user.ShowDialog() == DialogResult.OK)
            {
                labelUserName.Text = user.name;

                labelPause.Text      = "PAUSE";
                labelPause.BackColor = Color.Coral;
                labelPause.Visible   = false;

                snake = null;
                snake = new GameModeSnake(user.fieldX, user.fieldY);

                this.OnResize(null);

                labelLevel.Text = "Level: " + snake.Level();
                labelScore.Text = "Score: " + snake.score;

                timer1.Interval = 160 - ((snake.Level() - 1) * 20) + 1;
                timer1.Start();
                return(true);
            }
            return(false);
        }
Example #2
0
 private void changeUserToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (snake != null)
     {
         pause = false;
         startToolStripMenuItem_Click(sender, e);
         snake = null;
     }
     startToolStripMenuItem_Click(sender, e);
 }
Example #3
0
 public Form1()
 {
     InitializeComponent();
     pause = true;
     ShowWindow.InitializeContexts();
     snake      = null;
     ViewTop    = false;
     f          = false;
     background = 9;
 }