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
Enemy/Enemy.h@20:a359092079b0, 2019-04-25 (annotated)
- Committer:
- el17m2h
- Date:
- Thu Apr 25 11:34:01 2019 +0000
- Revision:
- 20:a359092079b0
- Child:
- 22:0d2ac98a8b48
I added a rectangle for the screen, updated the screen range and removed a floor. Added a tone for when the bullet is shot. Also added an enemy file that in contact with doodler the game ends. It also disappears if shot by bullet.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17m2h | 20:a359092079b0 | 1 | #ifndef ENEMY_H |
el17m2h | 20:a359092079b0 | 2 | #define ENEMY_H |
el17m2h | 20:a359092079b0 | 3 | |
el17m2h | 20:a359092079b0 | 4 | #include "mbed.h" |
el17m2h | 20:a359092079b0 | 5 | #include "N5110.h" |
el17m2h | 20:a359092079b0 | 6 | #include "Gamepad.h" |
el17m2h | 20:a359092079b0 | 7 | #include "Bullet.h" |
el17m2h | 20:a359092079b0 | 8 | |
el17m2h | 20:a359092079b0 | 9 | class Enemy{ |
el17m2h | 20:a359092079b0 | 10 | public: |
el17m2h | 20:a359092079b0 | 11 | Enemy(); |
el17m2h | 20:a359092079b0 | 12 | ~Enemy(); |
el17m2h | 20:a359092079b0 | 13 | void init(float floor_pos_x, float floor_pos_y); |
el17m2h | 20:a359092079b0 | 14 | void draw(N5110 &lcd); |
el17m2h | 20:a359092079b0 | 15 | void update(float floor_pos_x, float floor_pos_y); |
el17m2h | 20:a359092079b0 | 16 | Vector2D get_position(); |
el17m2h | 20:a359092079b0 | 17 | void set_position(Vector2D pos); // mutators |
el17m2h | 20:a359092079b0 | 18 | void set_score(int score); |
el17m2h | 20:a359092079b0 | 19 | |
el17m2h | 20:a359092079b0 | 20 | private: |
el17m2h | 20:a359092079b0 | 21 | Vector2D _position; |
el17m2h | 20:a359092079b0 | 22 | Bullet b; |
el17m2h | 20:a359092079b0 | 23 | float bullet_pos_y; |
el17m2h | 20:a359092079b0 | 24 | int _radius; |
el17m2h | 20:a359092079b0 | 25 | }; |
el17m2h | 20:a359092079b0 | 26 | #endif |