Li Ruofan 201199450

Dependencies:   mbed Gamepad Joystick

Committer:
DannyLee
Date:
Sat May 16 17:26:10 2020 +0000
Revision:
8:b4a2954dd74f
Parent:
myShip/spaceship.h@6:cbd9e1f26a10
Debugging

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DannyLee 3:cf9fead9c3f4 1 #ifndef spaceship_H
DannyLee 3:cf9fead9c3f4 2 #define spaceship_H
DannyLee 3:cf9fead9c3f4 3
DannyLee 3:cf9fead9c3f4 4 #include "mbed.h"
DannyLee 3:cf9fead9c3f4 5 #include "N5110.h"
DannyLee 3:cf9fead9c3f4 6 #include "Joystick.h"
DannyLee 3:cf9fead9c3f4 7 #include "Bitmap.h"
DannyLee 3:cf9fead9c3f4 8 /* spaceship Class
DannyLee 3:cf9fead9c3f4 9 @Library for Spaceship object in the spaceship project
DannyLee 3:cf9fead9c3f4 10 @coded by Li Ruofan
DannyLee 3:cf9fead9c3f4 11 @May 2020
DannyLee 3:cf9fead9c3f4 12 */
DannyLee 8:b4a2954dd74f 13 class Spaceship{
DannyLee 3:cf9fead9c3f4 14
DannyLee 3:cf9fead9c3f4 15 public:
DannyLee 3:cf9fead9c3f4 16 /* Construct function of our ship*/
DannyLee 3:cf9fead9c3f4 17 Spaceship();
DannyLee 3:cf9fead9c3f4 18
DannyLee 3:cf9fead9c3f4 19 /* Destruct function of our ship*/
DannyLee 3:cf9fead9c3f4 20 ~Spaceship();
DannyLee 3:cf9fead9c3f4 21
DannyLee 3:cf9fead9c3f4 22
DannyLee 3:cf9fead9c3f4 23 /* Initiate the position and the size of the ship
DannyLee 3:cf9fead9c3f4 24 @param the value of horizontal position x (int)
DannyLee 3:cf9fead9c3f4 25 @param the value of vertical position y (int)
DannyLee 3:cf9fead9c3f4 26 @param the columns of spaceship image (int)
DannyLee 3:cf9fead9c3f4 27 @param the rows of spaceship image (int)
DannyLee 3:cf9fead9c3f4 28 */
DannyLee 3:cf9fead9c3f4 29 void init(int x,int y,int width,int height);
DannyLee 6:cbd9e1f26a10 30
DannyLee 6:cbd9e1f26a10 31 /* draw the image of the ship
DannyLee 6:cbd9e1f26a10 32 @param lcd (N5110)
DannyLee 6:cbd9e1f26a10 33 */
DannyLee 6:cbd9e1f26a10 34 void draw(N5110 &lcd);
DannyLee 6:cbd9e1f26a10 35
DannyLee 3:cf9fead9c3f4 36 void update();
DannyLee 3:cf9fead9c3f4 37 /// access and mutate
DannyLee 3:cf9fead9c3f4 38
DannyLee 3:cf9fead9c3f4 39 /* get position and speed of spaceship in the lcd
DannyLee 3:cf9fead9c3f4 40 @return the current postion of spaceship
DannyLee 3:cf9fead9c3f4 41 */
DannyLee 3:cf9fead9c3f4 42 void set_speed(Vector2D v);
DannyLee 3:cf9fead9c3f4 43 Vector2D get_speed();
DannyLee 6:cbd9e1f26a10 44 Vector2D get_Pos();
DannyLee 3:cf9fead9c3f4 45
DannyLee 3:cf9fead9c3f4 46 private:
DannyLee 3:cf9fead9c3f4 47 Vector2D _velocity;
DannyLee 3:cf9fead9c3f4 48 int _x;
DannyLee 3:cf9fead9c3f4 49 int _y;
DannyLee 3:cf9fead9c3f4 50 int _width;
DannyLee 3:cf9fead9c3f4 51 int _height;
DannyLee 3:cf9fead9c3f4 52 int _speed;
DannyLee 6:cbd9e1f26a10 53
DannyLee 3:cf9fead9c3f4 54 };
DannyLee 3:cf9fead9c3f4 55 #endif