Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 15, 2020 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/7a1261cbf6506995a3c637af832808f9 to your computer and use it in GitHub Desktop.
Save parzibyte/7a1261cbf6506995a3c637af832808f9 to your computer and use it in GitHub Desktop.
// Saber en dónde está la comida para, más tarde, saber si la serpiente colisiona
int comidaX, comidaY;
// El puntaje. Se desborda cuando llega a 32767, creo
int puntaje = 0;
bool colisionaConComida() {
return serpiente[0].x == comidaX && serpiente[0].y == comidaY;
}
void loop() {
// ...
if (colisionaConComida()) {
puntaje++;
randomizarComida();
agregarPedazo(0, 0);// De hecho la posición del pedazo no importa al momento de agregar
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment