Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SnakeEngine.cpp
- Committer:
- JoeShotton
- Date:
- 2020-04-05
- Revision:
- 26:a596dce2f938
File content as of revision 26:a596dce2f938:
bool collision(int state, int x, int y,) {
if ((lcd.getPixel(x, y) == 1 && ((state == 1) || (state == 4))) || (lcd.getPixel(x+1, y+1) == 1 && ((state == 2) || (state == 3)))) {
// checks infront of head to see if pixel is set
// due to the size of the head, there is an offset for the check for North and Eastward directions
pad.led(1,0.9);
return true;
} else {
pad.led(1,0.0);
return = false;
}
}