private void bucle_Tick(object sender, EventArgs e) { g.Clear(Color.White); piedra.Draw(g); head.Draw(g); food.Draw(g); movimientos(); eatItself(); wallcrash(); if (head.Colision(food)) { head.eat(); score++; Puntos.Text = score.ToString(); comer.Play(); aux = rnd.Next() * 10; if (aux >= 30) { food.multipleFood(); } else { food.newFood(); } if (aux > 40) { piedra.Colocar(); if (piedra.Colision(food)) { food.newFood(); } } } }
public void Draw(Graphics g) { if (next != null) { next.Draw(g); } //dibujamos la serpiente y su cola g.FillRectangle(new SolidBrush(Color.DarkGoldenrod), this.x, this.y, this.ancho, this.ancho); }