Mortal Kombat Game ELEC2645
Dependencies: mbed N5110 ShiftReg Joystick
Fighter.h@6:a1a7dc264fed, 2021-04-21 (annotated)
- Committer:
- ozy
- Date:
- Wed Apr 21 22:56:55 2021 +0000
- Revision:
- 6:a1a7dc264fed
- Parent:
- 3:1d99b6ad4f9e
- Child:
- 7:737fb0c3dbef
Code before FighterClass change to GameEngine
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ozy | 0:99b49fd71085 | 1 | #ifndef FIGHTER_H |
ozy | 0:99b49fd71085 | 2 | #define FIGHTER_H |
ozy | 0:99b49fd71085 | 3 | |
ozy | 0:99b49fd71085 | 4 | #include "mbed.h" |
ozy | 0:99b49fd71085 | 5 | #include "N5110.h" |
ozy | 0:99b49fd71085 | 6 | |
ozy | 0:99b49fd71085 | 7 | |
ozy | 0:99b49fd71085 | 8 | class Fighter |
ozy | 0:99b49fd71085 | 9 | { |
ozy | 0:99b49fd71085 | 10 | public: |
ozy | 0:99b49fd71085 | 11 | Fighter(); // constructor |
ozy | 3:1d99b6ad4f9e | 12 | int get_x(); // get x co-ordinate |
ozy | 3:1d99b6ad4f9e | 13 | int get_y(); // get y co-ordinate |
ozy | 3:1d99b6ad4f9e | 14 | void set_x(int x); // set x co-ordinate |
ozy | 3:1d99b6ad4f9e | 15 | void set_y(int y); // set y co-ordinate |
ozy | 6:a1a7dc264fed | 16 | int add_x(int x); // add to the x co-ordinate |
ozy | 6:a1a7dc264fed | 17 | int add_y(int y); // add to the y co-ordinate |
ozy | 3:1d99b6ad4f9e | 18 | |
ozy | 6:a1a7dc264fed | 19 | // function to draw all the frames and move fighter based on button/joystick input |
ozy | 6:a1a7dc264fed | 20 | void draw(N5110 &lcd, DigitalIn &buttonA, DigitalIn &buttonB, DigitalIn &buttonC, DigitalIn &buttonD, AnalogIn &joy_v, AnalogIn &joy_h); |
ozy | 3:1d99b6ad4f9e | 21 | |
ozy | 3:1d99b6ad4f9e | 22 | private: |
ozy | 6:a1a7dc264fed | 23 | int _x, _y; // co-ordinates |
ozy | 0:99b49fd71085 | 24 | |
ozy | 0:99b49fd71085 | 25 | }; |
ozy | 0:99b49fd71085 | 26 | |
ozy | 0:99b49fd71085 | 27 | #endif |