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
SnakeEngine/SnakeEngine.cpp
- Committer:
- JoeShotton
- Date:
- 2020-05-20
- Revision:
- 3:fcd6d70e9694
- Child:
- 4:ea3fa51c4386
File content as of revision 3:fcd6d70e9694:
#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; } } */