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
SpaceRebEngine.h
00001 #ifndef SPACEREBENGINE_H 00002 #define SPACEREBENGINE_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 #include "SpaceInvader.h" 00008 #include "Missiles.h" 00009 00010 /** SpaceRebEngine class 00011 00012 @brief Class for Space Rebellion Engine 00013 00014 @version 1.0 00015 00016 @author Henri Rigby 00017 00018 @date May 2019 00019 00020 */ 00021 00022 class SpaceRebEngine 00023 { 00024 00025 public: 00026 /**constructor*/ 00027 SpaceRebEngine(); 00028 /**destructor*/ 00029 ~SpaceRebEngine(); 00030 /** 00031 * @brief Initialises spaceinvader and missiles 00032 * @param sets spaceinvader @details Sets height and width of the spaceinvader private variables 00033 * @param sets missiles @details Sets size and speed of the missiles private variables 00034 */ 00035 void init(int spaceinvader_width,int spaceinvader_height,int missiles_size,int speed); 00036 /** 00037 * @brief Sets joystick values 00038 * @param sets the joystick values @details Sets direction and magnitude of the joystick private variables 00039 */ 00040 void read_input(Gamepad &pad); 00041 /** 00042 * @brief Updates joystick and missiles values 00043 * @param sets the joystick values @details Sets direction and magnitude of the joystick private variables 00044 * @param sets missiles @details Sets size and speed of the missiles private variables 00045 */ 00046 void update(Gamepad &pad); 00047 /** 00048 * @brief Draws game 00049 * @return draw game components @details Draws spaceinvader, missiles & play area 00050 */ 00051 void draw(N5110 &lcd); 00052 /** 00053 * @brief Sets score and prints score 00054 * @param sets the score value @details Sets the value of _score private variable 00055 * @return prints value of score @details Prints the score on the lcd display 00056 */ 00057 void print_scores(N5110 &lcd); 00058 /** 00059 * @brief Sets value of _end 00060 * @param value of _end @details Returns the boolean value of _end 00061 */ 00062 void check_spaceinvader_collision(Gamepad &pad); 00063 /** 00064 * @brief Sets missiles velocity 00065 * @param sets velocity values of missiles @details Sets the values for velocity.x & velocity.y of missiles 00066 */ 00067 void check_wall_collision(Gamepad &pad); 00068 /** 00069 * @brief Gets value of end 00070 * @return value of end @details Returns the boolean value of end 00071 */ 00072 bool game_end(); 00073 00074 private: 00075 00076 SpaceInvader _player; 00077 00078 int _spaceinvader_width; 00079 int _spaceinvader_height; 00080 int _missiles_size; 00081 int _speed; 00082 int _score; 00083 00084 bool _end; 00085 00086 Missiles _missiles; 00087 00088 Direction _d; 00089 float _mag; 00090 00091 }; 00092 00093 #endif
Generated on Thu Jul 14 2022 11:01:22 by
1.7.2