Li Ruofan 201199450

Dependencies:   mbed Gamepad Joystick

Revision:
3:cf9fead9c3f4
Child:
5:e3a9f0548922
diff -r 5969f78a25ba -r cf9fead9c3f4 myShip/spaceship.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/myShip/spaceship.h	Thu May 14 13:12:28 2020 +0000
@@ -0,0 +1,53 @@
+#ifndef spaceship_H
+#define spaceship_H
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Joystick.h"
+#include "Bitmap.h"
+/* spaceship Class
+@Library for Spaceship object in the spaceship project
+@coded by Li Ruofan
+@May 2020
+*/
+class spaceship{
+
+public: 
+     /* Construct function of our ship*/
+     Spaceship();
+    
+     /* Destruct function of our ship*/
+     ~Spaceship();
+    
+    /* draw the image of the ship
+      @param lcd (N5110)
+     */
+    void draw(N5110 &lcd, int mode);
+    
+    /* Initiate the position and the size of the ship
+      @param the value of horizontal position x (int)
+      @param the value of vertical position y (int)
+      @param the columns of spaceship image (int)
+      @param the rows of spaceship image (int) 
+     */
+    void init(int x,int y,int width,int height);
+    void update();
+    /// access and mutate
+    
+     /* get position and speed of spaceship in the lcd
+       @return the current postion of spaceship
+     */        
+    void set_speed(Vector2D v);
+    Vector2D get_speed();
+    Vector2D get_pos();
+    void set_pos(Vector2D p);
+    
+private:
+    Vector2D _velocity;
+    int _x;
+    int _y;
+    int _width;
+    int _height;
+    int _speed;
+};
+#endif
\ No newline at end of file