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
Tank/Tank.h@17:cb39d9fa08dc, 2019-04-27 (annotated)
- Committer:
- el17mcd
- Date:
- Sat Apr 27 17:43:46 2019 +0000
- Revision:
- 17:cb39d9fa08dc
- Parent:
- 16:a2c945279b79
- Child:
- 21:44e87d88afe2
! Stylistic changes made to code so it conforms to google c++ guide. Beginning of inline commenting of source code.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17mcd | 12:9e6d5d0a0c82 | 1 | #ifndef TANK_H |
el17mcd | 12:9e6d5d0a0c82 | 2 | #define TANK_H |
el17mcd | 7:a3ccabdebe2e | 3 | |
el17mcd | 7:a3ccabdebe2e | 4 | #include "mbed.h" |
el17mcd | 7:a3ccabdebe2e | 5 | #include "N5110.h" |
el17mcd | 7:a3ccabdebe2e | 6 | #include "Gamepad.h" |
el17mcd | 7:a3ccabdebe2e | 7 | |
el17mcd | 12:9e6d5d0a0c82 | 8 | class Tank |
el17mcd | 7:a3ccabdebe2e | 9 | { |
el17mcd | 16:a2c945279b79 | 10 | |
el17mcd | 7:a3ccabdebe2e | 11 | public: |
el17mcd | 11:4e2eb64031a0 | 12 | |
el17mcd | 17:cb39d9fa08dc | 13 | Tank(); |
el17mcd | 17:cb39d9fa08dc | 14 | ~Tank(); |
el17mcd | 17:cb39d9fa08dc | 15 | |
el17mcd | 17:cb39d9fa08dc | 16 | //Accessors |
el17mcd | 17:cb39d9fa08dc | 17 | int get_position_x(); |
el17mcd | 17:cb39d9fa08dc | 18 | int get_position_y(); |
el17mcd | 17:cb39d9fa08dc | 19 | int get_hitbox(int i); |
el17mcd | 17:cb39d9fa08dc | 20 | int get_health(); |
el17mcd | 17:cb39d9fa08dc | 21 | //Mutators |
el17mcd | 17:cb39d9fa08dc | 22 | void set_position(int x, int y); |
el17mcd | 17:cb39d9fa08dc | 23 | void set_movement_limits(int left, int right); |
el17mcd | 17:cb39d9fa08dc | 24 | void set_health(int h); |
el17mcd | 17:cb39d9fa08dc | 25 | void set_speed(int s); |
el17mcd | 17:cb39d9fa08dc | 26 | //Other Methods |
el17mcd | 17:cb39d9fa08dc | 27 | void move_position(int d); |
el17mcd | 17:cb39d9fa08dc | 28 | void lose_health(); |
el17mcd | 17:cb39d9fa08dc | 29 | void generate_hitbox(); |
el17mcd | 17:cb39d9fa08dc | 30 | |
el17mcd | 17:cb39d9fa08dc | 31 | private: |
el17mcd | 16:a2c945279b79 | 32 | |
el17mcd | 17:cb39d9fa08dc | 33 | int _position_x; |
el17mcd | 17:cb39d9fa08dc | 34 | int _position_y; |
el17mcd | 17:cb39d9fa08dc | 35 | int _left_lim; |
el17mcd | 17:cb39d9fa08dc | 36 | int _right_lim; |
el17mcd | 17:cb39d9fa08dc | 37 | int _move_counter; |
el17mcd | 17:cb39d9fa08dc | 38 | int _speed; |
el17mcd | 17:cb39d9fa08dc | 39 | int _health; |
el17mcd | 17:cb39d9fa08dc | 40 | int _hitbox[40]; |
el17mcd | 7:a3ccabdebe2e | 41 | }; |
el17mcd | 7:a3ccabdebe2e | 42 | |
el17mcd | 12:9e6d5d0a0c82 | 43 | #endif // TANK_H |