James Heavey / Mbed 2 deprecated 2665-Breakout-Game

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Life_Powerup.h Source File

Life_Powerup.h

00001 #ifndef LIFE_POWERUP_H
00002 #define LIFE_POWERUP_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Paddle.h"
00008 #include "Bitmap.h"
00009 
00010 static int powerup_data[] = 
00011 {
00012     0, 0, 0, 1, 1, 1, 0, 0, 0, 
00013     0, 1, 1, 0, 0, 0, 1, 1, 0, 
00014     0, 1, 0, 1, 0, 1, 0, 1, 0, 
00015     1, 0, 1, 1, 1, 1, 1, 0, 1, 
00016     1, 0, 1, 1, 1, 1, 1, 0, 1, 
00017     1, 0, 0, 1, 1, 1, 0, 0, 1, 
00018     0, 1, 0, 0, 1, 0, 0, 1, 0, 
00019     0, 1, 1, 0, 0, 0, 1, 1, 0, 
00020     0, 0, 0, 1, 1, 1, 0, 0, 0
00021 };
00022 
00023 /** Life_Powerup Class
00024 @author James Heavey, University of Leeds
00025 @brief Controls the Life_Powerup in the Breakout game
00026 @date May 2019
00027 */
00028 
00029 class Life_Powerup
00030 {
00031 public:
00032 
00033     /** Constructor declaration */
00034     Life_Powerup();
00035     
00036     /** Destructor declaration */
00037     ~Life_Powerup();
00038     
00039     /** Initialises the powerup off screen with a set velocity */
00040     void init();
00041     
00042     /** Draws the powerup at at its current coordinates on the LCD
00043     * @param lcd @details a N5110 pointer
00044     */
00045     void draw(N5110 &lcd);
00046     
00047     /** Update the powerup's y coordinate based on its velocity */
00048     void update();
00049     
00050     /** Sets the powerups's x coordinate
00051     * @param x @details set the variable _x to the new local x
00052     */
00053     void set_posx(int x);
00054     
00055     /** Sets the powerups's x coordinate
00056     * @param y @details set the variable _y to the new local y
00057     */
00058     void set_posy(int y);
00059     
00060     /** Retrieve the powerup's current x coordinate
00061     * @returns variable _x as an integer
00062     */
00063     int get_x();
00064     
00065     /** Retrieve the powerup's current y coordinate
00066     * @returns variable _y as an integer
00067     */
00068     int get_y();
00069 
00070 private:
00071     int _speed_y;
00072     int _x;
00073     int _y;
00074 };
00075 #endif