Li Ruofan 201199450

Dependencies:   mbed Gamepad Joystick

Committer:
DannyLee
Date:
Fri May 15 19:57:40 2020 +0000
Revision:
5:e3a9f0548922
Parent:
3:cf9fead9c3f4
Child:
6:cbd9e1f26a10
need to debug

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 3:cf9fead9c3f4 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 /* draw the image of the ship
DannyLee 3:cf9fead9c3f4 23 @param lcd (N5110)
DannyLee 3:cf9fead9c3f4 24 */
DannyLee 3:cf9fead9c3f4 25 void draw(N5110 &lcd, int mode);
DannyLee 3:cf9fead9c3f4 26
DannyLee 3:cf9fead9c3f4 27 /* Initiate the position and the size of the ship
DannyLee 3:cf9fead9c3f4 28 @param the value of horizontal position x (int)
DannyLee 3:cf9fead9c3f4 29 @param the value of vertical position y (int)
DannyLee 3:cf9fead9c3f4 30 @param the columns of spaceship image (int)
DannyLee 3:cf9fead9c3f4 31 @param the rows of spaceship image (int)
DannyLee 3:cf9fead9c3f4 32 */
DannyLee 3:cf9fead9c3f4 33 void init(int x,int y,int width,int height);
DannyLee 3:cf9fead9c3f4 34 void update();
DannyLee 3:cf9fead9c3f4 35 /// access and mutate
DannyLee 3:cf9fead9c3f4 36
DannyLee 3:cf9fead9c3f4 37 /* get position and speed of spaceship in the lcd
DannyLee 3:cf9fead9c3f4 38 @return the current postion of spaceship
DannyLee 3:cf9fead9c3f4 39 */
DannyLee 3:cf9fead9c3f4 40 void set_speed(Vector2D v);
DannyLee 3:cf9fead9c3f4 41 Vector2D get_speed();
DannyLee 3:cf9fead9c3f4 42 Vector2D get_pos();
DannyLee 3:cf9fead9c3f4 43 void set_pos(Vector2D p);
DannyLee 5:e3a9f0548922 44 void set_pos(Vector2D p);
DannyLee 5:e3a9f0548922 45
DannyLee 5:e3a9f0548922 46 void add_score();
DannyLee 5:e3a9f0548922 47
DannyLee 5:e3a9f0548922 48 int get_score();
DannyLee 5:e3a9f0548922 49
DannyLee 5:e3a9f0548922 50 void set_life();
DannyLee 5:e3a9f0548922 51
DannyLee 5:e3a9f0548922 52 int get_life();
DannyLee 3:cf9fead9c3f4 53
DannyLee 3:cf9fead9c3f4 54 private:
DannyLee 3:cf9fead9c3f4 55 Vector2D _velocity;
DannyLee 3:cf9fead9c3f4 56 int _x;
DannyLee 3:cf9fead9c3f4 57 int _y;
DannyLee 3:cf9fead9c3f4 58 int _width;
DannyLee 3:cf9fead9c3f4 59 int _height;
DannyLee 3:cf9fead9c3f4 60 int _speed;
DannyLee 5:e3a9f0548922 61 int _score;
DannyLee 5:e3a9f0548922 62 int _life;
DannyLee 3:cf9fead9c3f4 63 };
DannyLee 3:cf9fead9c3f4 64 #endif