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.
Dependencies: mbed ll16j23s_test_docs
Diff: SnakeEngine/SnakeEngine.cpp
- Revision:
- 3:fcd6d70e9694
- Child:
- 4:ea3fa51c4386
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SnakeEngine/SnakeEngine.cpp Wed May 20 21:25:40 2020 +0000 @@ -0,0 +1,55 @@ +#include "SnakeEngine.h" + +SnakeEngine::SnakeEngine() +{ +//constructor +} + +SnakeEngine::~SnakeEngine() +{ +//destructor +} + +void SnakeEngine::read_input(Gamepad &pad) +{ + //_d = pad.get_direction(); + //_mag = pad.get_mag(); +} + +/* +int Gamepad::get_cardinal() +{ + float angle = get_angle(); // 0 to 360, -1 for centred + + int d = 0; + // partition 360 into segments and check which segment the angle is in + if (angle < 0.0f) { + d = 0; // check for -1.0 angle + } else if (angle < 22.5f) { // then keep going in 45 degree increments + d = 1; + } else if (angle < 112.5f) { + d = 2; + } else if (angle < 202.5f) { + d = 3; + } else if (angle < 292.5f) { + d = 4; + } else { + d = 1; + } + + return d; +} +*/ + +/* 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; + } +} +*/ \ No newline at end of file