ELEC2645 (2019/20)
/
ELEC2645_Project_el18jb
test 1 doc
Engine/Engine.cpp@3:e4e1cbf750b6, 2020-05-18 (annotated)
- Committer:
- joebarhouch
- Date:
- Mon May 18 16:06:27 2020 +0000
- Revision:
- 3:e4e1cbf750b6
- Child:
- 4:cf5088ace087
Character movement with game engine
Who changed what in which revision?
User | Revision | Line number | New 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 | 3:e4e1cbf750b6 | 17 | |
joebarhouch | 3:e4e1cbf750b6 | 18 | //init call |
joebarhouch | 3:e4e1cbf750b6 | 19 | _p.init(_px, _py); |
joebarhouch | 3:e4e1cbf750b6 | 20 | } |
joebarhouch | 3:e4e1cbf750b6 | 21 | |
joebarhouch | 3:e4e1cbf750b6 | 22 | void Engine::read_input(Gamepad &pad) |
joebarhouch | 3:e4e1cbf750b6 | 23 | { |
joebarhouch | 3:e4e1cbf750b6 | 24 | _d = pad.get_direction(); |
joebarhouch | 3:e4e1cbf750b6 | 25 | _mag = pad.get_mag(); |
joebarhouch | 3:e4e1cbf750b6 | 26 | } |
joebarhouch | 3:e4e1cbf750b6 | 27 | |
joebarhouch | 3:e4e1cbf750b6 | 28 | void Engine::draw(N5110 &lcd) |
joebarhouch | 3:e4e1cbf750b6 | 29 | { |
joebarhouch | 3:e4e1cbf750b6 | 30 | // player |
joebarhouch | 3:e4e1cbf750b6 | 31 | _p.draw(lcd); |
joebarhouch | 3:e4e1cbf750b6 | 32 | } |
joebarhouch | 3:e4e1cbf750b6 | 33 | |
joebarhouch | 3:e4e1cbf750b6 | 34 | void Engine::update(Gamepad &pad) |
joebarhouch | 3:e4e1cbf750b6 | 35 | { |
joebarhouch | 3:e4e1cbf750b6 | 36 | |
joebarhouch | 3:e4e1cbf750b6 | 37 | _p.update(_d,_mag); |
joebarhouch | 3:e4e1cbf750b6 | 38 | //wallCollide(pad); |
joebarhouch | 3:e4e1cbf750b6 | 39 | //enemmyCollide(pad); |
joebarhouch | 3:e4e1cbf750b6 | 40 | } |
joebarhouch | 3:e4e1cbf750b6 | 41 | |
joebarhouch | 3:e4e1cbf750b6 | 42 | /* |
joebarhouch | 3:e4e1cbf750b6 | 43 | void Engine::wallCollision(Gamepad &pad) |
joebarhouch | 3:e4e1cbf750b6 | 44 | { |
joebarhouch | 3:e4e1cbf750b6 | 45 | } |
joebarhouch | 3:e4e1cbf750b6 | 46 | |
joebarhouch | 3:e4e1cbf750b6 | 47 | void PongEngine::check_paddle_collisions(Gamepad &pad) |
joebarhouch | 3:e4e1cbf750b6 | 48 | { |
joebarhouch | 3:e4e1cbf750b6 | 49 | } |
joebarhouch | 3:e4e1cbf750b6 | 50 | |
joebarhouch | 3:e4e1cbf750b6 | 51 | void PongEngine::print_health(N5110 &lcd) |
joebarhouch | 3:e4e1cbf750b6 | 52 | { |
joebarhouch | 3:e4e1cbf750b6 | 53 | } |
joebarhouch | 3:e4e1cbf750b6 | 54 | |
joebarhouch | 3:e4e1cbf750b6 | 55 | */ |