ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jgb

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Spikes.h Source File

Spikes.h

00001 #ifndef SPIKES_H
00002 #define SPIKES_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Aim.h"
00008 #include "Heston.h"
00009 
00010 /** Spikes class
00011  * @brief falling sprites to be avoided 
00012  * @author Joe Body, University of Leeds
00013  * @date May 2020
00014  */   
00015 
00016 class Spikes
00017 {
00018 
00019 public:
00020 
00021     /** Constructor */
00022     Spikes();
00023     
00024     /** Destructor */
00025     ~Spikes();
00026     
00027     /** Initalises Spikes*/
00028     void init();
00029     
00030     /** Draws the first type of spike
00031     * @param lcd @details N5110 object
00032     */
00033     void draw(N5110 &lcd);
00034     
00035     /** Draws the second type of spike
00036     * @param lcd @details N5110 object
00037     */
00038     void draw2(N5110 &lcd);
00039     
00040     /** Draws the third type of spike
00041     * @param lcd @details N5110 object
00042     */
00043     void draw3(N5110 &lcd);
00044     
00045     /** update the y direction */
00046     void updatey();
00047     
00048     /** update the x direction */
00049     void updatex();
00050     
00051     /** update the x direction negatively*/
00052     void updatexn();
00053     
00054     /** set initial random position of a spike 
00055     * @param int x @ details 1-4 determines general section of screen
00056     */
00057     void position(int x);
00058     
00059     /** set co ordinates of sprite 
00060     * @param int x 
00061     * @param int y 
00062     */
00063     void set_pos(int x, int y);
00064     
00065     /** gets co-ordinates of the sprite
00066     * @ return position vector  
00067     */
00068     Vector2D get_pos();
00069     
00070     /** set co ordinates of sprite 
00071     * @param pad @detail  Gampad object 
00072     */
00073     void hit(Gamepad &pad);
00074     
00075 private:
00076     
00077     /**vertical size sprite
00078     * @return _height
00079     */
00080     int _height;
00081     
00082     /**horizontal size sprite
00083     * @return _height
00084     */
00085     int _width;
00086     
00087     /** x position of sprite
00088     * @return _x
00089     */
00090     int _x;
00091     
00092     /** y position of sprite
00093     * @return _y
00094     */
00095     int _y;
00096     
00097     /** speed of sprite
00098     * @return _speed
00099     */
00100     int _speed;
00101 
00102 };
00103 
00104 
00105 #endif