ELEC2645 (2019/20)
/
ELEC2645_Project_el18jb
test 1 doc
Engine/Engine.cpp
- Committer:
- joebarhouch
- Date:
- 2020-05-25
- Revision:
- 6:00d20886e4f8
- Parent:
- 5:928c2eee4109
- Child:
- 7:530ca713d2b2
File content as of revision 6:00d20886e4f8:
#include "Engine.h" Engine::Engine() { } Engine::~Engine() { } ////////////////////// INIT //////////////////////////// void Engine::init() { //init coord _px = WIDTH / 2; _py = 10; //init call _p.init(_px, _py); } ////////////////////// INPUT ////////////////////////// //reads direction and magnitude from the JOYSTICK to control the player void Engine::read_input(Gamepad &pad) { _d = pad.get_direction(); _mag = pad.get_mag(); } ////////////////////// DRAW /////////////////////////// //draw both player and map void Engine::draw(N5110 &lcd) { // player _p.draw(lcd); drawMap(lcd); } ////////////////////// UPDATE ////////////////////////// //provide the player file with necessary Joystick values void Engine::update(Gamepad &pad) { _p.update(_d,_mag); } /* floorCollide(); if (_collision == true) { //debug //printf("collison\n"); } else { //debug //printf("no collison\n"); } //enemmyCollide(pad); } */ /* ////////////////////// FLOOR COLLISION ////////////////////////// bool Engine::floorCollide() { Vector2D player = _p.get_pos(); _collision = false; if ( player.x +1 >= plat.x && player.x +1 <= plat.x + plat.width ) { _collision = true; } else { _collision = false; } return _collision; } */