Example #1
0
 private void timerAnimacion_Tick(object sender, EventArgs e)
 {
     Niveles();
     DibujarTodo();
     MoverTodo();
     ChocarPared();
     ChocarCuerpo();
     ColisonObstaculo();
     ChocarSerpienteEnemiga();
     if (cabeza.Colision(manzana))//Sepiente usuario
     {
         manzana = new Comida(escenario.Width, escenario.Height);
         puntaje++;
         textoPuntaje.Text = puntaje + "";
         cabeza.Agregar();
     }
     if (puntaje >= 4)
     {
         if (cabeza3.Colision(manzana))//Sepiente enemiga1
         {
             manzana = new Comida(escenario.Width, escenario.Height);
             cabeza3.Agregar();
         }
     }
     else
     if (puntaje >= 2)
     {
         if (cabeza2.Colision(manzana))//Sepiente enemiga1
         {
             manzana = new Comida(escenario.Width, escenario.Height);
             cabeza2.Agregar();
         }
     }
 }
 public void Agregar()
 {
     if (siguiente == null)
     {
         siguiente = new CuerpoSerpiente(valorX, valorY);
     }
     else
     {
         siguiente.Agregar();
     }
 }