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.
Character/Character.h@17:c81c09625d92, 2020-05-26 (annotated)
- Committer:
- Albutt
- Date:
- Tue May 26 23:07:51 2020 +0000
- Revision:
- 17:c81c09625d92
- Parent:
- 12:c557b6c9b17a
- Child:
- 18:77394d8e6c3d
Testing Documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Albutt | 2:c25ec0da7636 | 1 | #include "mbed.h" |
Albutt | 2:c25ec0da7636 | 2 | #include "N5110.h" |
Albutt | 2:c25ec0da7636 | 3 | #include "Gamepad.h" |
Albutt | 17:c81c09625d92 | 4 | /** Character Class |
Albutt | 17:c81c09625d92 | 5 | @author Albert Tan Muligan, Student at University of Leeds |
Albutt | 17:c81c09625d92 | 6 | @brief Controls the Character in a shooter game |
Albutt | 17:c81c09625d92 | 7 | @date May 2020 |
Albutt | 2:c25ec0da7636 | 8 | |
Albutt | 2:c25ec0da7636 | 9 | |
Albutt | 17:c81c09625d92 | 10 | */ |
Albutt | 2:c25ec0da7636 | 11 | class Character |
Albutt | 2:c25ec0da7636 | 12 | { |
Albutt | 2:c25ec0da7636 | 13 | public: |
Albutt | 2:c25ec0da7636 | 14 | Character(); |
Albutt | 2:c25ec0da7636 | 15 | ~Character(); |
Albutt | 17:c81c09625d92 | 16 | /** |
Albutt | 17:c81c09625d92 | 17 | * @brief Sets inital x and y |
Albutt | 17:c81c09625d92 | 18 | * @param x and y @details x and y in pixels (max x = 84, y = 48) |
Albutt | 17:c81c09625d92 | 19 | */ |
Albutt | 2:c25ec0da7636 | 20 | void init(int x,int y); |
Albutt | 2:c25ec0da7636 | 21 | void draw(N5110 &lcd); |
Albutt | 12:c557b6c9b17a | 22 | void update(Direction d); |
Albutt | 17:c81c09625d92 | 23 | /** |
Albutt | 17:c81c09625d92 | 24 | * @brief Resets x, y and direction to original(center, facing up) values |
Albutt | 17:c81c09625d92 | 25 | */ |
Albutt | 10:71ced616a64f | 26 | void reset(); |
Albutt | 17:c81c09625d92 | 27 | ///Direction accessor |
Albutt | 4:b16b6078a432 | 28 | int get_direction(); |
Albutt | 17:c81c09625d92 | 29 | ///X value accessor |
Albutt | 4:b16b6078a432 | 30 | int get_x(); |
Albutt | 17:c81c09625d92 | 31 | ///X value accessor |
Albutt | 4:b16b6078a432 | 32 | int get_y(); |
Albutt | 2:c25ec0da7636 | 33 | |
Albutt | 2:c25ec0da7636 | 34 | private: |
Albutt | 2:c25ec0da7636 | 35 | |
Albutt | 2:c25ec0da7636 | 36 | int _x; |
Albutt | 2:c25ec0da7636 | 37 | int _y; |
Albutt | 2:c25ec0da7636 | 38 | int _speed; |
Albutt | 2:c25ec0da7636 | 39 | int _dir; |
Albutt | 2:c25ec0da7636 | 40 | }; |