Beispiel #1
0
 private void MouseNewStart(object sender, MouseEventArgs e)
 {
     if (_game.HasEnd())
     {
         NewStart();
     }
 }
Beispiel #2
0
        private void Loop()
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            TimeSpan elapsed = TimeSpan.Zero;

            while (true)
            {
                if (elapsed.Seconds != st.Elapsed.Seconds && st.Elapsed.Seconds % _config.PlayVelocity / 2 == 0)
                {
                    game.Logik();
                    if (game.HasEnd())
                    {
                        game.NewGame();
                    }
                }
                else if (st.Elapsed.Milliseconds % 41 == 0)
                {
                    pictureBox1.Invoke(new MethodInvoker(UpdateImageLocation));
                }
                elapsed = st.Elapsed;
            }
        }