![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Owen Cavender 201159294
GameEngine.cpp
- Committer:
- el17oc
- Date:
- 2020-05-28
- Revision:
- 9:a69a6a06dddf
- Parent:
- 8:997f90c88246
- Child:
- 10:ee781d18e0f6
File content as of revision 9:a69a6a06dddf:
#include "GameEngine.h" GameEngine::GameEngine() { } GameEngine::~GameEngine() { } void GameEngine::print_display_time(N5110 &lcd) { int countdown = _realtime; char buffer1[14]; sprintf(buffer1,"%2d",countdown); lcd.printString(buffer1,WIDTH/2,1); // font is 8 wide, so leave 4 pixel gape from middle assuming two digits char buffer2[14]; } void GameEngine::print_scores(N5110 &lcd, Snake &snake) { int score = snake.get_score(); char buffer1[14]; sprintf(buffer1,"%2d",score); lcd.printString(buffer1,WIDTH/2 - 3,1); // font is 8 wide, so leave 4 pixel gape from middle assuming two digits char buffer2[14]; } void GameEngine::get_LEDs(Gamepad &pad, Snake &snake) { pad.leds_off(); Vector2D Snakehead = snake.get_Snakehead(); int _x0 = Snakehead.x; int _y0 = Snakehead.y; if (_x0 >= 42 && _y0 >= 24) { // top right led on pad.led(4, 1); } // topleft led on if (_x0 <= 42 && _y0 >=24) { // top right led on pad.led(1, 1); } //bottom left if (_x0 <=42 && _y0 <= 24) { pad.led(3,1); } //bottom right if (_x0 >= 42 && _y0 <= 24) { // top right led on pad.led(6, 1); } }