Exemplo n.º 1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (if_game_active)
     {
         game_field.CreateGraphics().Clear(Color.Black);
         snake.Move();
         snake.draw(game_field.CreateGraphics(), new SolidBrush(Color.Aqua));
         fruit.draw_fruit(game_field.CreateGraphics(), new SolidBrush(Color.Red));
         if (fruit.if_new_fruit(snake.x[0], snake.y[0]))
         {
             snake.add();
         }
         if (snake.if_snake_alive() == false)
         {
             if_game_active = false;
         }
     }
     else
     {
         FontFamily fontFamily1 = new FontFamily("Arial");
         Font       f           = new Font(fontFamily1, 15);
         Brush      b           = new SolidBrush(Color.Aqua);
         game_field.CreateGraphics().DrawString("Press the Start", f, b, 80, 135);
     }
 }