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
Projectile/Projectile.h@9:fe912235dd71, 2019-04-10 (annotated)
- Committer:
- el17mcd
- Date:
- Wed Apr 10 14:27:37 2019 +0000
- Revision:
- 9:fe912235dd71
- Parent:
- 8:d4e419dad90f
- Child:
- 11:4e2eb64031a0
! Working prototype for projectile ballistics using classes.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17mcd | 7:a3ccabdebe2e | 1 | #ifndef PROJECTILE_H |
| el17mcd | 7:a3ccabdebe2e | 2 | #define PROJECTILE_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 | 7:a3ccabdebe2e | 8 | |
| el17mcd | 7:a3ccabdebe2e | 9 | class Projectile |
| el17mcd | 7:a3ccabdebe2e | 10 | { |
| el17mcd | 7:a3ccabdebe2e | 11 | public: |
| el17mcd | 7:a3ccabdebe2e | 12 | |
| el17mcd | 7:a3ccabdebe2e | 13 | void draw(N5110 &lcd); |
| el17mcd | 8:d4e419dad90f | 14 | void generate_hitbox(); |
| el17mcd | 9:fe912235dd71 | 15 | void update_flight(); |
| el17mcd | 9:fe912235dd71 | 16 | bool check_boundaries(); |
| el17mcd | 7:a3ccabdebe2e | 17 | void set_position(int x, int y); |
| el17mcd | 9:fe912235dd71 | 18 | void set_launch_parameters(int t, int x, int y, float ang, float vel, float grav, float wind); |
| el17mcd | 7:a3ccabdebe2e | 19 | int get_position_x(); |
| el17mcd | 7:a3ccabdebe2e | 20 | int get_position_y(); |
| el17mcd | 7:a3ccabdebe2e | 21 | int get_hitbox(int i); |
| el17mcd | 7:a3ccabdebe2e | 22 | |
| el17mcd | 7:a3ccabdebe2e | 23 | private: |
| el17mcd | 7:a3ccabdebe2e | 24 | |
| el17mcd | 7:a3ccabdebe2e | 25 | int _position_x; |
| el17mcd | 7:a3ccabdebe2e | 26 | int _position_y; |
| el17mcd | 7:a3ccabdebe2e | 27 | int _hitbox[5]; |
| el17mcd | 8:d4e419dad90f | 28 | int _time; |
| el17mcd | 8:d4e419dad90f | 29 | int _init_x; |
| el17mcd | 8:d4e419dad90f | 30 | int _init_y; |
| el17mcd | 8:d4e419dad90f | 31 | float _lnch_ang; |
| el17mcd | 9:fe912235dd71 | 32 | float _init_vel; //1.3 |
| el17mcd | 9:fe912235dd71 | 33 | float _grav_acc; //0.02 |
| el17mcd | 8:d4e419dad90f | 34 | float _wind_acc; |
| el17mcd | 7:a3ccabdebe2e | 35 | |
| el17mcd | 7:a3ccabdebe2e | 36 | }; |
| el17mcd | 7:a3ccabdebe2e | 37 | |
| el17mcd | 7:a3ccabdebe2e | 38 | #endif // PROJECTILE_H |