test 1 doc

Dependencies:   mbed Gamepad2

Committer:
joebarhouch
Date:
Fri May 22 01:26:24 2020 +0000
Revision:
5:928c2eee4109
Parent:
4:cf5088ace087
Child:
6:00d20886e4f8
Platform classes for map design;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joebarhouch 3:e4e1cbf750b6 1 #include "Engine.h"
joebarhouch 3:e4e1cbf750b6 2
joebarhouch 3:e4e1cbf750b6 3 Engine::Engine()
joebarhouch 3:e4e1cbf750b6 4 {
joebarhouch 3:e4e1cbf750b6 5
joebarhouch 3:e4e1cbf750b6 6 }
joebarhouch 3:e4e1cbf750b6 7 Engine::~Engine()
joebarhouch 3:e4e1cbf750b6 8 {
joebarhouch 3:e4e1cbf750b6 9
joebarhouch 3:e4e1cbf750b6 10 }
joebarhouch 3:e4e1cbf750b6 11
joebarhouch 3:e4e1cbf750b6 12 void Engine::init()
joebarhouch 3:e4e1cbf750b6 13 {
joebarhouch 3:e4e1cbf750b6 14 //init coord
joebarhouch 3:e4e1cbf750b6 15 _px = WIDTH / 2;
joebarhouch 3:e4e1cbf750b6 16 _py = HEIGHT / 2;
joebarhouch 5:928c2eee4109 17 _plat.init();
joebarhouch 3:e4e1cbf750b6 18 //init call
joebarhouch 3:e4e1cbf750b6 19 _p.init(_px, _py);
joebarhouch 3:e4e1cbf750b6 20 }
joebarhouch 3:e4e1cbf750b6 21
joebarhouch 5:928c2eee4109 22 //reads direction and magnitude from the JOYSTICK to control the player
joebarhouch 3:e4e1cbf750b6 23 void Engine::read_input(Gamepad &pad)
joebarhouch 3:e4e1cbf750b6 24 {
joebarhouch 3:e4e1cbf750b6 25 _d = pad.get_direction();
joebarhouch 3:e4e1cbf750b6 26 _mag = pad.get_mag();
joebarhouch 3:e4e1cbf750b6 27 }
joebarhouch 3:e4e1cbf750b6 28
joebarhouch 5:928c2eee4109 29
joebarhouch 5:928c2eee4109 30 //draw both player and map
joebarhouch 3:e4e1cbf750b6 31 void Engine::draw(N5110 &lcd)
joebarhouch 3:e4e1cbf750b6 32 {
joebarhouch 3:e4e1cbf750b6 33 // player
joebarhouch 3:e4e1cbf750b6 34 _p.draw(lcd);
joebarhouch 5:928c2eee4109 35 _plat.draw(lcd);
joebarhouch 4:cf5088ace087 36
joebarhouch 3:e4e1cbf750b6 37 }
joebarhouch 3:e4e1cbf750b6 38
joebarhouch 5:928c2eee4109 39 //provide the player file with necessary Joystick values
joebarhouch 3:e4e1cbf750b6 40 void Engine::update(Gamepad &pad)
joebarhouch 3:e4e1cbf750b6 41 {
joebarhouch 3:e4e1cbf750b6 42
joebarhouch 3:e4e1cbf750b6 43 _p.update(_d,_mag);
joebarhouch 3:e4e1cbf750b6 44 //enemmyCollide(pad);
joebarhouch 3:e4e1cbf750b6 45 }
joebarhouch 3:e4e1cbf750b6 46
joebarhouch 5:928c2eee4109 47
joebarhouch 3:e4e1cbf750b6 48 /*
joebarhouch 3:e4e1cbf750b6 49
joebarhouch 3:e4e1cbf750b6 50 void PongEngine::check_paddle_collisions(Gamepad &pad)
joebarhouch 3:e4e1cbf750b6 51 {
joebarhouch 3:e4e1cbf750b6 52 }
joebarhouch 3:e4e1cbf750b6 53
joebarhouch 3:e4e1cbf750b6 54 void PongEngine::print_health(N5110 &lcd)
joebarhouch 3:e4e1cbf750b6 55 {
joebarhouch 3:e4e1cbf750b6 56 }
joebarhouch 3:e4e1cbf750b6 57
joebarhouch 3:e4e1cbf750b6 58 */