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@30:4504b5dd47d1, 2020-05-17 (annotated)
- Committer:
- josh_ohara
- Date:
- Sun May 17 15:15:27 2020 +0000
- Revision:
- 30:4504b5dd47d1
- Parent:
- 29:1615c1cffa6f
- Child:
- 31:27c938ec2a11
1
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 | 30:4504b5dd47d1 | 13 | /** Constructor */ |
| josh_ohara | 27:eb755a345b1f | 14 | AlienBullet(); |
| josh_ohara | 30:4504b5dd47d1 | 15 | /** Destructor */ |
| josh_ohara | 16:987f72d9bb8f | 16 | ~AlienBullet(); |
| josh_ohara | 30:4504b5dd47d1 | 17 | /** Set private variabls |
| josh_ohara | 30:4504b5dd47d1 | 18 | * @param the x and y position of the bullet |
| josh_ohara | 30:4504b5dd47d1 | 19 | */ |
| josh_ohara | 27:eb755a345b1f | 20 | void init(int x, int y); //initialises objects and sets private variables |
| josh_ohara | 30:4504b5dd47d1 | 21 | |
| josh_ohara | 27:eb755a345b1f | 22 | void render(N5110 &lcd); //draws bullet |
| josh_ohara | 27:eb755a345b1f | 23 | void update(); //udpdates private variables |
| josh_ohara | 27:eb755a345b1f | 24 | //accessors and mutators |
| josh_ohara | 27:eb755a345b1f | 25 | Vector2D get_position(); //returns the x and y position of the bullet |
| josh_ohara | 27:eb755a345b1f | 26 | void set_hit(bool x); //sets the hit value of the bullet |
| josh_ohara | 27:eb755a345b1f | 27 | bool get_hit(); //returns the hit value of the bullet |
| josh_ohara | 16:987f72d9bb8f | 28 | |
| josh_ohara | 16:987f72d9bb8f | 29 | private: |
| josh_ohara | 27:eb755a345b1f | 30 | int _y; //y position of the bullet |
| josh_ohara | 27:eb755a345b1f | 31 | int _x; //x position of the bullet |
| josh_ohara | 27:eb755a345b1f | 32 | int _speed; //speed of the bullet (y direction) |
| josh_ohara | 27:eb755a345b1f | 33 | 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 | 34 | |
| josh_ohara | 16:987f72d9bb8f | 35 | }; |
| josh_ohara | 16:987f72d9bb8f | 36 | |
| josh_ohara | 16:987f72d9bb8f | 37 |