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
Gameengine Class Reference
Gameengine Class @1 make the whole explorer game run and set the score the reset process @2 cheak the collision and the reset or fall flag @3 draw on the lcd screen and load the gamepad controll. More...
#include <Gameengine.h>
Public Member Functions | |
| Gameengine () | |
| Constructor. | |
| ~Gameengine () | |
| Destructor. | |
| void | init () |
| Initalises the Gameengine. | |
| void | reset_game_engine () |
| reset the gameengine. | |
| void | read_input (Gamepad &pad) |
| get the coordinate and the button_flag. | |
| void | check_reset (N5110 &lcd, Gamepad &gamepad) |
| check and flesh the reset flag. | |
| void | check_collision (Gamepad &gamepad) |
| check and flesh the collision flag. | |
| void | check_start (N5110 &lcd, Gamepad &gamepad) |
| check and flesh the start flag. | |
| void | set_fall_flag () |
| set the fall flag for engine. | |
| bool | get_start_flag () |
| get the start flag. | |
| void | generate_lines () |
| generate the upper and lower lines. | |
| int | get_score () |
| get the player score. | |
| void | get_explorer_direction () |
| get the player's direction. | |
| void | get_sprite () |
| get the item and explorer sprite. | |
| void | get_explorer_y (Gamepad &gamepad) |
| get player's y. | |
| void | get_explorer_x () |
| get player's y. | |
| void | update_lcd (N5110 &lcd) |
| Updates the LCD display. | |
| void | run_engine (N5110 &lcd, Gamepad &gamepad) |
| run the game. | |
Detailed Description
Gameengine Class @1 make the whole explorer game run and set the score the reset process @2 cheak the collision and the reset or fall flag @3 draw on the lcd screen and load the gamepad controll.
- Date:
- April 24th 2020
#include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Gameengine.h" N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad gamepad; Gameengine _game_engine; bool _start_flag; int _player_score; int main() { _game_engine.init(); while(1) { _game_engine.check_reset(lcd, gamepad); _start_flag = _game_engine.get_start_flag(); _game_engine.read_input(gamepad); _game_engine.get_sprite(); _game_engine.get_explorer_direction(); _game_engine.get_explorer_y(gamepad); _game_engine.get_explorer_x(); _game_engine.generate_lines(); _game_engine.check_collision(gamepad); _game_engine.update_lcd(lcd); _player_score = _game_engine.get_score(); _game_engine.run_engine(lcd, gamepad); } }
Definition at line 61 of file Gameengine.h.
Constructor & Destructor Documentation
| Gameengine | ( | ) |
| ~Gameengine | ( | ) |
Member Function Documentation
| void check_collision | ( | Gamepad & | gamepad ) |
check and flesh the collision flag.
- Parameters:
-
&gamepad The gamepad object from Gamepad class.
Definition at line 73 of file Gameengine.cpp.
check and flesh the reset flag.
Definition at line 29 of file Gameengine.cpp.
check and flesh the start flag.
Definition at line 45 of file Gameengine.cpp.
| void generate_lines | ( | ) |
generate the upper and lower lines.
Definition at line 83 of file Gameengine.cpp.
| void get_explorer_direction | ( | ) |
get the player's direction.
Definition at line 108 of file Gameengine.cpp.
| void get_explorer_x | ( | ) |
get player's y.
Definition at line 113 of file Gameengine.cpp.
| void get_explorer_y | ( | Gamepad & | gamepad ) |
get player's y.
- Parameters:
-
&gamepad The gamepad object from Gamepad class.
Definition at line 51 of file Gameengine.cpp.
| int get_score | ( | ) |
get the player score.
Definition at line 104 of file Gameengine.cpp.
| void get_sprite | ( | ) |
get the item and explorer sprite.
Definition at line 110 of file Gameengine.cpp.
| bool get_start_flag | ( | ) |
get the start flag.
Definition at line 98 of file Gameengine.cpp.
| void init | ( | ) |
Initalises the Gameengine.
Definition at line 8 of file Gameengine.cpp.
| void read_input | ( | Gamepad & | pad ) |
get the coordinate and the button_flag.
- Parameters:
-
&gamepad The gamepad object from Gamepad class.
Definition at line 25 of file Gameengine.cpp.
| void reset_game_engine | ( | ) |
reset the gameengine.
Definition at line 14 of file Gameengine.cpp.
run the game.
Definition at line 131 of file Gameengine.cpp.
| void set_fall_flag | ( | ) |
set the fall flag for engine.
Definition at line 62 of file Gameengine.cpp.
| void update_lcd | ( | N5110 & | lcd ) |
Updates the LCD display.
- Parameters:
-
&lcd The lcd object from the N5110 class.
Definition at line 118 of file Gameengine.cpp.
Generated on Thu Jul 14 2022 16:52:38 by
1.7.2