ELEC2645 (2018/19) / Mbed 2 deprecated el17set_

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Coin.h Source File

Coin.h

00001 #ifndef COIN_H
00002 #define COIN_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 
00008 const int coin_01[2][2] = {
00009   {1,1},
00010   {1,1}
00011 
00012   };
00013 
00014 /** Coin class
00015 
00016 @brief Class of the collectable coin
00017 
00018 @version 1.0
00019 
00020 @author Spencer Tingle
00021 
00022 @date 09/05/19
00023 
00024 */
00025 
00026 class Coin{
00027 
00028  public:
00029 
00030   Coin();
00031   ~Coin();
00032   /** 
00033   * @brief Init
00034   * @param x, y @details Initiates coordinates of coins
00035   */
00036   void init(int x, int y);
00037   /** 
00038   * @brief Get x
00039   * @details Gets the coin's current x-coordinate
00040   */
00041   int get_x_coin();
00042   /** 
00043   * @brief Get y
00044   * @details Gets the coin's current y-coordinate
00045   */
00046   int get_y_coin();
00047   /** 
00048   * @brief Get coins
00049   * @details Gets the current number of coins collected
00050   */
00051   int get_coins();
00052   /** 
00053   * @brief Draw coin
00054   * @param lcd @details Draws the coin sprite
00055   */
00056   void drawSprite(N5110 &lcd);
00057   /** 
00058   * @brief Coin collision
00059   * @param x, y, pad @details Detects collsions and plays tone when true
00060   */
00061   bool collidePlayer(int x, int y, Gamepad &pad);
00062   /** 
00063   * @brief Coin collision
00064   * @param x, y, lcd, pad @details Detects collsions and plays tone when true
00065   */
00066   void spawn(int x, int y, N5110 &lcd, Gamepad &pad);
00067 
00068  private:
00069 
00070   bool _spawn;
00071   int coin;
00072   int x_coin;
00073   int y_coin;
00074   int accel;
00075 
00076 };
00077 
00078 #endif