![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Adam Baker 201166301
Dependencies: mbed Gamepad N5110
BlockheadEngine/BlockheadEngine.cpp@34:911d7d05a8d2, 2019-05-02 (annotated)
- Committer:
- adambakerwa
- Date:
- Thu May 02 13:22:38 2019 +0000
- Revision:
- 34:911d7d05a8d2
- Parent:
- 32:06344b45bbab
- Child:
- 35:7d69c0822ea9
safety comit before reorganising code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adambakerwa | 25:230e4163cb6b | 1 | #include "mbed.h" |
adambakerwa | 25:230e4163cb6b | 2 | #include "Gamepad.h" |
adambakerwa | 25:230e4163cb6b | 3 | #include "N5110.h" |
adambakerwa | 25:230e4163cb6b | 4 | #include "BlockheadEngine.h" |
adambakerwa | 25:230e4163cb6b | 5 | |
adambakerwa | 25:230e4163cb6b | 6 | BlockheadEngine::BlockheadEngine() |
adambakerwa | 25:230e4163cb6b | 7 | { |
adambakerwa | 25:230e4163cb6b | 8 | |
adambakerwa | 25:230e4163cb6b | 9 | } |
adambakerwa | 25:230e4163cb6b | 10 | |
adambakerwa | 25:230e4163cb6b | 11 | BlockheadEngine::~BlockheadEngine() |
adambakerwa | 25:230e4163cb6b | 12 | { |
adambakerwa | 25:230e4163cb6b | 13 | |
adambakerwa | 25:230e4163cb6b | 14 | } |
adambakerwa | 25:230e4163cb6b | 15 | |
adambakerwa | 26:3319ddd5111d | 16 | void BlockheadEngine::init() |
adambakerwa | 26:3319ddd5111d | 17 | { |
adambakerwa | 26:3319ddd5111d | 18 | _move = _runner.init(_move); |
adambakerwa | 26:3319ddd5111d | 19 | _pos = _lev.init(_pos); |
adambakerwa | 28:934bb0da48ab | 20 | |
adambakerwa | 27:c0fa8e41743b | 21 | |
adambakerwa | 26:3319ddd5111d | 22 | } |
adambakerwa | 26:3319ddd5111d | 23 | |
adambakerwa | 31:bf765e3961f1 | 24 | void BlockheadEngine::continueInit() |
adambakerwa | 31:bf765e3961f1 | 25 | { |
adambakerwa | 32:06344b45bbab | 26 | _move = _runner.continue_init(_move); |
adambakerwa | 31:bf765e3961f1 | 27 | _pos = _lev.init(_pos); |
adambakerwa | 31:bf765e3961f1 | 28 | |
adambakerwa | 31:bf765e3961f1 | 29 | |
adambakerwa | 31:bf765e3961f1 | 30 | } |
adambakerwa | 31:bf765e3961f1 | 31 | |
adambakerwa | 25:230e4163cb6b | 32 | int BlockheadEngine::playgame(N5110 &lcd, Gamepad &pad) |
adambakerwa | 25:230e4163cb6b | 33 | { |
adambakerwa | 25:230e4163cb6b | 34 | |
adambakerwa | 34:911d7d05a8d2 | 35 | _level = _runner.next_level(); |
adambakerwa | 34:911d7d05a8d2 | 36 | _pos = _lev.whatLevel(lcd, _level); |
adambakerwa | 25:230e4163cb6b | 37 | _move = _runner.blockhead(_move, _pos, lcd, pad); |
adambakerwa | 32:06344b45bbab | 38 | _gameover = _runner.gameover_flag(_move, pad); |
adambakerwa | 27:c0fa8e41743b | 39 | |
adambakerwa | 29:b2f63d8c1268 | 40 | // char buffer[14]; |
adambakerwa | 29:b2f63d8c1268 | 41 | // sprintf(buffer,"%i", _move.go); |
adambakerwa | 29:b2f63d8c1268 | 42 | // lcd.printString(buffer,2,0); |
adambakerwa | 25:230e4163cb6b | 43 | |
adambakerwa | 25:230e4163cb6b | 44 | return _gameover; |
adambakerwa | 25:230e4163cb6b | 45 | } |
adambakerwa | 25:230e4163cb6b | 46 |