ELEC2645 (2018/19) / Mbed 2 deprecated el17set_

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Baby.h Source File

Baby.h

00001 #ifndef BABY_H
00002 #define BABY_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 
00008 const int sprite_01[7][7] = {
00009   {0,0,1,1,0,0,0},
00010   {0,0,0,1,0,0,0},
00011   {1,0,0,0,0,0,1},
00012   {1,0,1,0,1,0,1},
00013   {1,0,1,0,1,0,1},
00014   {1,0,0,0,0,0,1},
00015   {1,1,1,1,1,1,1}
00016 
00017   };
00018 
00019 /** Baby class
00020 
00021 @brief Class of the controllable player
00022 
00023 @version 1.0
00024 
00025 @author Spencer Tingle
00026 
00027 @date 09/05/19
00028 
00029 */
00030 
00031 class Baby{
00032 
00033  public:
00034 
00035   Baby();
00036   ~Baby();
00037   /** 
00038   * @brief Init
00039   * @param x, y @details Initiates coordinates of baby
00040   */
00041   void init(int x,int y);
00042   /** 
00043   * @brief Get x
00044   * @details Gets the baby's current x-coordinate
00045   */
00046   int get_x_char();
00047   /** 
00048   * @brief Get y
00049   * @details Gets the baby's current y-coordinate
00050   */
00051   int get_y_char();
00052   /** 
00053   * @brief Draw baby
00054   * @param lcd @details Draws the baby sprite
00055   */
00056   void drawSprite(N5110 &lcd);
00057   /** 
00058   * @brief Moves baby
00059   * @param dir, lcd @details Moves the baby sprite
00060   */
00061   void movement(Direction dir, N5110 &lcd);
00062   /** 
00063   * @brief North collsision
00064   * @param x, y, lcd @details Detects if baby sprite is colliding on north side
00065   */
00066   bool northCollision(int x, int y, N5110 &lcd);
00067   /** 
00068   * @brief South collsision
00069   * @param x, y, lcd @details Detects if baby sprite is colliding on south side
00070   */
00071   bool southCollision(int x, int y, N5110 &lcd);
00072   /** 
00073   * @brief East collsision
00074   * @param x, y, lcd @details Detects if baby sprite is colliding on east side
00075   */
00076   bool eastCollision(int x, int y, N5110 &lcd);
00077   /** 
00078   * @brief West collsision
00079   * @param x, y, lcd @details Detects if baby sprite is colliding on west side
00080   */
00081   bool westCollision(int x, int y, N5110 &lcd);
00082     
00083  private:
00084 
00085   int x_char;
00086   int y_char;
00087   int accel;
00088      
00089 };
00090     
00091 #endif