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
Fire Class Reference
#include <Fire.h>
Public Member Functions | |
| Fire () | |
| Constructor, non user specified. | |
| ~Fire () | |
| Destructor, non user specified. | |
| void | init () |
| Initialises Fire object. | |
| int * | get_fire_sprite () |
| Gets the sprite. | |
| int | get_fire_x () |
| Gets the x coordinate. | |
| void | generate_fire () |
| Generates Fire parameters. | |
Detailed Description
Fire Class.
Generates a fire ball that will end the game if the skateboarder touches it
- Date:
- April 2019
#include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Fire.h" #include <cstdlib> #include <ctime> N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad gamepad; Fire _fire; int _skater_y; int _fire_y; int main() { _fire.init(); _fire_y = 20; while(1) { // Generates the x coordinate of the fire. _fire.generate_fire(); // Generates X coord of fire. // Y is calculated from parabolic relation to game counter. // Check for a collision. if (_skater_x == _fire.get_fire_x() && _skater_y > _fire_y - 10 && _skater_y < _fire_y + 10 ) { // A range of Y coords to make collision // more frequent. // Print fire. lcd.drawSprite(_fire.get_fire_x(),_fire_y,5,8, (int*)_fire.get_fire_sprite()); } } }
Definition at line 53 of file Fire.h.
Constructor & Destructor Documentation
Member Function Documentation
| void generate_fire | ( | ) |
| int * get_fire_sprite | ( | ) |
| int get_fire_x | ( | ) |
Generated on Mon Jul 18 2022 14:06:02 by
1.7.2