James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Committer:
jamesheavey
Date:
Thu May 09 07:32:56 2019 +0000
Revision:
131:c227bbfb38b0
Parent:
130:46f3fac2bdf9
Child:
135:888ae932cd70
cp before reducing function length in menus

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jamesheavey 114:280903dd7e06 1 #ifndef LIFE_POWERUP_H
jamesheavey 114:280903dd7e06 2 #define LIFE_POWERUP_H
jamesheavey 114:280903dd7e06 3
jamesheavey 114:280903dd7e06 4 #include "mbed.h"
jamesheavey 114:280903dd7e06 5 #include "N5110.h"
jamesheavey 114:280903dd7e06 6 #include "Gamepad.h"
jamesheavey 114:280903dd7e06 7 #include "Paddle.h"
jamesheavey 114:280903dd7e06 8 #include "Bitmap.h"
jamesheavey 114:280903dd7e06 9
jamesheavey 114:280903dd7e06 10 /* Life_Powerup Class
jamesheavey 114:280903dd7e06 11 @author James Heavey, University of Leeds
jamesheavey 114:280903dd7e06 12 @brief Controls the Life_Powerup in the Breakout game
jamesheavey 114:280903dd7e06 13 @date May 2019
jamesheavey 114:280903dd7e06 14 */
jamesheavey 114:280903dd7e06 15
jamesheavey 114:280903dd7e06 16 static int powerup_data[] =
jamesheavey 114:280903dd7e06 17 {
jamesheavey 114:280903dd7e06 18 0, 0, 0, 1, 1, 1, 0, 0, 0,
jamesheavey 114:280903dd7e06 19 0, 1, 1, 0, 0, 0, 1, 1, 0,
jamesheavey 114:280903dd7e06 20 0, 1, 0, 1, 0, 1, 0, 1, 0,
jamesheavey 114:280903dd7e06 21 1, 0, 1, 1, 1, 1, 1, 0, 1,
jamesheavey 114:280903dd7e06 22 1, 0, 1, 1, 1, 1, 1, 0, 1,
jamesheavey 114:280903dd7e06 23 1, 0, 0, 1, 1, 1, 0, 0, 1,
jamesheavey 114:280903dd7e06 24 0, 1, 0, 0, 1, 0, 0, 1, 0,
jamesheavey 114:280903dd7e06 25 0, 1, 1, 0, 0, 0, 1, 1, 0,
jamesheavey 114:280903dd7e06 26 0, 0, 0, 1, 1, 1, 0, 0, 0
jamesheavey 114:280903dd7e06 27 };
jamesheavey 114:280903dd7e06 28
jamesheavey 114:280903dd7e06 29 class Life_Powerup
jamesheavey 114:280903dd7e06 30 {
jamesheavey 129:b47c28c7eaaf 31 public:
jamesheavey 114:280903dd7e06 32
jamesheavey 129:b47c28c7eaaf 33 /** Constructor declaration */
jamesheavey 114:280903dd7e06 34 Life_Powerup();
jamesheavey 129:b47c28c7eaaf 35
jamesheavey 129:b47c28c7eaaf 36 /** Destructor declaration */
jamesheavey 114:280903dd7e06 37 ~Life_Powerup();
jamesheavey 129:b47c28c7eaaf 38
jamesheavey 129:b47c28c7eaaf 39 /** Initialises the powerup off screen with a set velocity */
jamesheavey 114:280903dd7e06 40 void init();
jamesheavey 129:b47c28c7eaaf 41
jamesheavey 129:b47c28c7eaaf 42 /** Draws the powerup at at its current coordinates on the LCD
jamesheavey 130:46f3fac2bdf9 43 * @param lcd @details a N5110 pointer
jamesheavey 129:b47c28c7eaaf 44 */
jamesheavey 114:280903dd7e06 45 void draw(N5110 &lcd);
jamesheavey 129:b47c28c7eaaf 46
jamesheavey 129:b47c28c7eaaf 47 /** Update the powerup's y coordinate based on its velocity */
jamesheavey 114:280903dd7e06 48 void update();
jamesheavey 129:b47c28c7eaaf 49
jamesheavey 129:b47c28c7eaaf 50 /** Sets the powerups's x coordinate
jamesheavey 131:c227bbfb38b0 51 * @param x @details set the variable _x to the new local x
jamesheavey 129:b47c28c7eaaf 52 */
jamesheavey 129:b47c28c7eaaf 53 void set_posx(int x);
jamesheavey 129:b47c28c7eaaf 54
jamesheavey 129:b47c28c7eaaf 55 /** Sets the powerups's x coordinate
jamesheavey 131:c227bbfb38b0 56 * @param y @details set the variable _y to the new local y
jamesheavey 129:b47c28c7eaaf 57 */
jamesheavey 129:b47c28c7eaaf 58 void set_posy(int y);
jamesheavey 129:b47c28c7eaaf 59
jamesheavey 129:b47c28c7eaaf 60 /** Retrieve the powerup's current x coordinate
jamesheavey 131:c227bbfb38b0 61 * @return returns variable _x as an integer
jamesheavey 129:b47c28c7eaaf 62 */
jamesheavey 114:280903dd7e06 63 int get_x();
jamesheavey 129:b47c28c7eaaf 64
jamesheavey 129:b47c28c7eaaf 65 /** Retrieve the powerup's current y coordinate
jamesheavey 131:c227bbfb38b0 66 * @return returns variable _y as an integer
jamesheavey 129:b47c28c7eaaf 67 */
jamesheavey 114:280903dd7e06 68 int get_y();
jamesheavey 114:280903dd7e06 69
jamesheavey 114:280903dd7e06 70 private:
jamesheavey 114:280903dd7e06 71 int _speed_y;
jamesheavey 114:280903dd7e06 72 int _x;
jamesheavey 114:280903dd7e06 73 int _y;
jamesheavey 114:280903dd7e06 74 };
jamesheavey 114:280903dd7e06 75 #endif