Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17zl by
PushingEngine/PushingEngine.h@7:6f8aeadc4370, 2019-04-11 (annotated)
- Committer:
- franklzw
- Date:
- Thu Apr 11 14:14:28 2019 +0000
- Revision:
- 7:6f8aeadc4370
- Parent:
- 6:6b083e22cb53
- Child:
- 8:83891ea9a5d9
barrier-box-ppl works! no off-screen, no cover of each other.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
franklzw | 2:9f0d9516a6cd | 1 | #ifndef PUSHINGENGINE_H |
franklzw | 2:9f0d9516a6cd | 2 | #define PUSHINGENGINE_H |
franklzw | 2:9f0d9516a6cd | 3 | |
franklzw | 2:9f0d9516a6cd | 4 | #include "mbed.h" |
franklzw | 2:9f0d9516a6cd | 5 | #include "N5110.h" |
franklzw | 2:9f0d9516a6cd | 6 | #include "Gamepad.h" |
franklzw | 2:9f0d9516a6cd | 7 | #include "Ppl.h" |
franklzw | 2:9f0d9516a6cd | 8 | #include "Box.h" |
franklzw | 2:9f0d9516a6cd | 9 | |
franklzw | 2:9f0d9516a6cd | 10 | |
franklzw | 2:9f0d9516a6cd | 11 | |
franklzw | 2:9f0d9516a6cd | 12 | class PushingEngine |
franklzw | 2:9f0d9516a6cd | 13 | { |
franklzw | 2:9f0d9516a6cd | 14 | |
franklzw | 2:9f0d9516a6cd | 15 | public: |
franklzw | 2:9f0d9516a6cd | 16 | PushingEngine(); |
franklzw | 2:9f0d9516a6cd | 17 | ~PushingEngine(); |
franklzw | 2:9f0d9516a6cd | 18 | |
franklzw | 4:750d3f9b54de | 19 | void init(int box1_x,int box1_y,int box2_x,int box2_y,int ppl_x,int ppl_y); |
franklzw | 2:9f0d9516a6cd | 20 | void read_input(Gamepad &pad); |
franklzw | 6:6b083e22cb53 | 21 | void update(Gamepad &pad,int barrier_x,int barrier_y); |
franklzw | 6:6b083e22cb53 | 22 | void draw(N5110 &lcd,int barrier_x,int barrier_y); |
franklzw | 6:6b083e22cb53 | 23 | |
franklzw | 2:9f0d9516a6cd | 24 | |
franklzw | 2:9f0d9516a6cd | 25 | private: |
franklzw | 2:9f0d9516a6cd | 26 | |
franklzw | 4:750d3f9b54de | 27 | void check_ppl_box1_touching(Gamepad &pad); |
franklzw | 4:750d3f9b54de | 28 | void check_ppl_box2_touching(Gamepad &pad); |
franklzw | 6:6b083e22cb53 | 29 | void hold_ppl_box1_wall(Gamepad &pad); |
franklzw | 6:6b083e22cb53 | 30 | void hold_ppl_box2_wall(Gamepad &pad); |
franklzw | 7:6f8aeadc4370 | 31 | bool ppl_cover_box(Gamepad &pad); |
franklzw | 6:6b083e22cb53 | 32 | |
franklzw | 2:9f0d9516a6cd | 33 | |
franklzw | 2:9f0d9516a6cd | 34 | Box _b1; |
franklzw | 2:9f0d9516a6cd | 35 | Box _b2; |
franklzw | 2:9f0d9516a6cd | 36 | |
franklzw | 2:9f0d9516a6cd | 37 | // positions of the Boxes |
franklzw | 2:9f0d9516a6cd | 38 | int _b1x; |
franklzw | 2:9f0d9516a6cd | 39 | int _b2x; |
franklzw | 2:9f0d9516a6cd | 40 | int _b1y; |
franklzw | 2:9f0d9516a6cd | 41 | int _b2y; |
franklzw | 2:9f0d9516a6cd | 42 | |
franklzw | 2:9f0d9516a6cd | 43 | Ppl _ppl; |
franklzw | 2:9f0d9516a6cd | 44 | |
franklzw | 2:9f0d9516a6cd | 45 | // poitions of the ppl |
franklzw | 2:9f0d9516a6cd | 46 | int _pplx; |
franklzw | 2:9f0d9516a6cd | 47 | int _pply; |
franklzw | 5:b50ce6160013 | 48 | |
franklzw | 5:b50ce6160013 | 49 | //reading of bottom |
franklzw | 5:b50ce6160013 | 50 | int _bb; |
franklzw | 5:b50ce6160013 | 51 | int _bx; |
franklzw | 5:b50ce6160013 | 52 | int _by; |
franklzw | 5:b50ce6160013 | 53 | int _ba; |
franklzw | 5:b50ce6160013 | 54 | int _bjoy; |
franklzw | 2:9f0d9516a6cd | 55 | |
franklzw | 5:b50ce6160013 | 56 | //parameter for touching |
franklzw | 5:b50ce6160013 | 57 | int _s; //ppl with b1 |
franklzw | 5:b50ce6160013 | 58 | int _r; //ppl with b2 |
franklzw | 6:6b083e22cb53 | 59 | int _temp; |
franklzw | 2:9f0d9516a6cd | 60 | |
franklzw | 2:9f0d9516a6cd | 61 | }; |
franklzw | 2:9f0d9516a6cd | 62 | |
franklzw | 2:9f0d9516a6cd | 63 | #endif |