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
AlienBullet/AlienBullet.h@31:27c938ec2a11, 2020-05-17 (annotated)
- Committer:
- josh_ohara
- Date:
- Sun May 17 16:32:36 2020 +0000
- Revision:
- 31:27c938ec2a11
- Parent:
- 30:4504b5dd47d1
- Child:
- 38:6f50b548226e
more tidying;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| josh_ohara | 16:987f72d9bb8f | 1 | #include "mbed.h" |
| josh_ohara | 16:987f72d9bb8f | 2 | #include "N5110.h" |
| josh_ohara | 16:987f72d9bb8f | 3 | #include "Gamepad.h" |
| josh_ohara | 16:987f72d9bb8f | 4 | |
| josh_ohara | 30:4504b5dd47d1 | 5 | /** Alien Bullet class |
| josh_ohara | 30:4504b5dd47d1 | 6 | * @brief Creates and controlsalien bullet object |
| josh_ohara | 30:4504b5dd47d1 | 7 | * @author Joshua O'hara |
| josh_ohara | 30:4504b5dd47d1 | 8 | * @date May, 2017 |
| josh_ohara | 30:4504b5dd47d1 | 9 | */ |
| josh_ohara | 16:987f72d9bb8f | 10 | class AlienBullet |
| josh_ohara | 16:987f72d9bb8f | 11 | { |
| josh_ohara | 16:987f72d9bb8f | 12 | public: |
| josh_ohara | 27:eb755a345b1f | 13 | AlienBullet(); |
| josh_ohara | 16:987f72d9bb8f | 14 | ~AlienBullet(); |
| josh_ohara | 27:eb755a345b1f | 15 | void init(int x, int y); //initialises objects and sets private variables |
| josh_ohara | 27:eb755a345b1f | 16 | void render(N5110 &lcd); //draws bullet |
| josh_ohara | 27:eb755a345b1f | 17 | void update(); //udpdates private variables |
| josh_ohara | 27:eb755a345b1f | 18 | //accessors and mutators |
| josh_ohara | 27:eb755a345b1f | 19 | Vector2D get_position(); //returns the x and y position of the bullet |
| josh_ohara | 27:eb755a345b1f | 20 | void set_hit(bool x); //sets the hit value of the bullet |
| josh_ohara | 27:eb755a345b1f | 21 | bool get_hit(); //returns the hit value of the bullet |
| josh_ohara | 16:987f72d9bb8f | 22 | |
| josh_ohara | 16:987f72d9bb8f | 23 | private: |
| josh_ohara | 27:eb755a345b1f | 24 | int _y; //y position of the bullet |
| josh_ohara | 27:eb755a345b1f | 25 | int _x; //x position of the bullet |
| josh_ohara | 27:eb755a345b1f | 26 | int _speed; //speed of the bullet (y direction) |
| josh_ohara | 27:eb755a345b1f | 27 | bool _hit; //variable to show if bullet has caused a hit, functions the same as the life variable of the ship but logically opposite |
| josh_ohara | 16:987f72d9bb8f | 28 | |
| josh_ohara | 16:987f72d9bb8f | 29 | }; |
| josh_ohara | 16:987f72d9bb8f | 30 | |
| josh_ohara | 16:987f72d9bb8f | 31 |