Li Ruofan 201199450
Dependencies: mbed Gamepad Joystick
UFO/UFO.h@6:cbd9e1f26a10, 2020-05-15 (annotated)
- Committer:
- DannyLee
- Date:
- Fri May 15 21:16:14 2020 +0000
- Revision:
- 6:cbd9e1f26a10
- Parent:
- 5:e3a9f0548922
- Child:
- 8:b4a2954dd74f
still debuging
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DannyLee | 3:cf9fead9c3f4 | 1 | #ifndef UFO_H |
DannyLee | 3:cf9fead9c3f4 | 2 | #define UFO_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 | /* UFO Class |
DannyLee | 3:cf9fead9c3f4 | 9 | @Library for UFO 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 UFO{ |
DannyLee | 3:cf9fead9c3f4 | 14 | |
DannyLee | 3:cf9fead9c3f4 | 15 | public: |
DannyLee | 3:cf9fead9c3f4 | 16 | /* Constructor & Destructor */ |
DannyLee | 5:e3a9f0548922 | 17 | UFO(); |
DannyLee | 3:cf9fead9c3f4 | 18 | |
DannyLee | 3:cf9fead9c3f4 | 19 | ~UFO(); |
DannyLee | 3:cf9fead9c3f4 | 20 | |
DannyLee | 3:cf9fead9c3f4 | 21 | /* Initiate the position and the size of the UFO |
DannyLee | 3:cf9fead9c3f4 | 22 | @param the value of horizontal position x (int) |
DannyLee | 3:cf9fead9c3f4 | 23 | @param the value of vertical position y (int) |
DannyLee | 3:cf9fead9c3f4 | 24 | @param the columns of UFO image (int) |
DannyLee | 3:cf9fead9c3f4 | 25 | @param the rows of UFO image (int) |
DannyLee | 3:cf9fead9c3f4 | 26 | */ |
DannyLee | 6:cbd9e1f26a10 | 27 | void init(int x,int y,int _width,int _height); |
DannyLee | 3:cf9fead9c3f4 | 28 | |
DannyLee | 3:cf9fead9c3f4 | 29 | /* Get the position of UFO in lcd |
DannyLee | 3:cf9fead9c3f4 | 30 | @return the position of UFO in lcd |
DannyLee | 3:cf9fead9c3f4 | 31 | */ |
DannyLee | 3:cf9fead9c3f4 | 32 | Vector2D getPos(); |
DannyLee | 3:cf9fead9c3f4 | 33 | |
DannyLee | 3:cf9fead9c3f4 | 34 | /* Update the position of UFO |
DannyLee | 3:cf9fead9c3f4 | 35 | */ |
DannyLee | 3:cf9fead9c3f4 | 36 | void update(); |
DannyLee | 3:cf9fead9c3f4 | 37 | |
DannyLee | 3:cf9fead9c3f4 | 38 | /* draw the image of the UFO |
DannyLee | 3:cf9fead9c3f4 | 39 | * @param lcd (N5110) |
DannyLee | 3:cf9fead9c3f4 | 40 | * @param the value difficulty mode (int) |
DannyLee | 3:cf9fead9c3f4 | 41 | */ |
DannyLee | 3:cf9fead9c3f4 | 42 | void draw(N5110 &lcd,int mode); |
DannyLee | 3:cf9fead9c3f4 | 43 | |
DannyLee | 3:cf9fead9c3f4 | 44 | /** Set the UFO speed |
DannyLee | 3:cf9fead9c3f4 | 45 | * @param the value of UFO speed |
DannyLee | 3:cf9fead9c3f4 | 46 | */ |
DannyLee | 3:cf9fead9c3f4 | 47 | void setSpeed(int speed); |
DannyLee | 3:cf9fead9c3f4 | 48 | |
DannyLee | 3:cf9fead9c3f4 | 49 | /** Get the speed of the UFO |
DannyLee | 3:cf9fead9c3f4 | 50 | * @return the value of speed of the UFO (int) |
DannyLee | 3:cf9fead9c3f4 | 51 | */ |
DannyLee | 3:cf9fead9c3f4 | 52 | int getSpeed(); |
DannyLee | 3:cf9fead9c3f4 | 53 | |
DannyLee | 3:cf9fead9c3f4 | 54 | /** Get the blood of the UFO |
DannyLee | 3:cf9fead9c3f4 | 55 | * @return the blood of the UFO |
DannyLee | 3:cf9fead9c3f4 | 56 | */ |
DannyLee | 3:cf9fead9c3f4 | 57 | int getBlood(); |
DannyLee | 3:cf9fead9c3f4 | 58 | |
DannyLee | 3:cf9fead9c3f4 | 59 | /** Set the blood of the UFO |
DannyLee | 3:cf9fead9c3f4 | 60 | * @param the blood of the UFO |
DannyLee | 3:cf9fead9c3f4 | 61 | */ |
DannyLee | 3:cf9fead9c3f4 | 62 | void setBlood(int harm); |
DannyLee | 3:cf9fead9c3f4 | 63 | |
DannyLee | 3:cf9fead9c3f4 | 64 | private: |
DannyLee | 3:cf9fead9c3f4 | 65 | int _x; |
DannyLee | 3:cf9fead9c3f4 | 66 | int _y; |
DannyLee | 6:cbd9e1f26a10 | 67 | int _width; |
DannyLee | 6:cbd9e1f26a10 | 68 | int _height; |
DannyLee | 3:cf9fead9c3f4 | 69 | int _speed; |
DannyLee | 3:cf9fead9c3f4 | 70 | int _blood; |
DannyLee | 3:cf9fead9c3f4 | 71 | |
DannyLee | 3:cf9fead9c3f4 | 72 | }; |
DannyLee | 3:cf9fead9c3f4 | 73 | #endif |