deemo1

Dependencies:   mbed

Committer:
haoyan
Date:
Thu May 14 06:30:39 2020 +0000
Revision:
6:b59bc5e15cf3
Parent:
1:8c48fb8ca5e0
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
haoyan 1:8c48fb8ca5e0 1 #ifndef BATTLESHIP_H
haoyan 1:8c48fb8ca5e0 2 #define BATTLESHIP_H
haoyan 1:8c48fb8ca5e0 3
haoyan 1:8c48fb8ca5e0 4 #include "mbed.h"
haoyan 1:8c48fb8ca5e0 5 #include "N5110.h"
haoyan 1:8c48fb8ca5e0 6 #include "Gamepad.h"
haoyan 1:8c48fb8ca5e0 7
haoyan 1:8c48fb8ca5e0 8 /** Battleship Class
haoyan 1:8c48fb8ca5e0 9 * @brief Battleship
haoyan 1:8c48fb8ca5e0 10 * @author Haoyan Zhang
haoyan 1:8c48fb8ca5e0 11 * @date April, 2020
haoyan 1:8c48fb8ca5e0 12 */
haoyan 1:8c48fb8ca5e0 13
haoyan 1:8c48fb8ca5e0 14 class Battleship
haoyan 1:8c48fb8ca5e0 15 {
haoyan 1:8c48fb8ca5e0 16 public:
haoyan 1:8c48fb8ca5e0 17
haoyan 1:8c48fb8ca5e0 18 Battleship(); // Constructor
haoyan 1:8c48fb8ca5e0 19
haoyan 1:8c48fb8ca5e0 20 ~Battleship(); // Destructor
haoyan 1:8c48fb8ca5e0 21
haoyan 1:8c48fb8ca5e0 22 void init(int x,int height,int width); // Initialization
haoyan 1:8c48fb8ca5e0 23
haoyan 1:8c48fb8ca5e0 24 void draw(N5110 &lcd); // Draw the pattern on lcd
haoyan 1:8c48fb8ca5e0 25
haoyan 1:8c48fb8ca5e0 26 void update(Direction d,float mag); // Update the values
haoyan 1:8c48fb8ca5e0 27
haoyan 1:8c48fb8ca5e0 28 void add_score(); // Add the score
haoyan 1:8c48fb8ca5e0 29
haoyan 1:8c48fb8ca5e0 30 int get_score(); // Get the score
haoyan 1:8c48fb8ca5e0 31
haoyan 1:8c48fb8ca5e0 32 Vector2D get_pos(); // Get the position
haoyan 1:8c48fb8ca5e0 33
haoyan 1:8c48fb8ca5e0 34 void minus_life(); // Minus the life
haoyan 1:8c48fb8ca5e0 35
haoyan 1:8c48fb8ca5e0 36 int get_life(); // Get the life
haoyan 1:8c48fb8ca5e0 37
haoyan 1:8c48fb8ca5e0 38 private:
haoyan 1:8c48fb8ca5e0 39
haoyan 1:8c48fb8ca5e0 40 int _x;
haoyan 1:8c48fb8ca5e0 41
haoyan 1:8c48fb8ca5e0 42 int _y;
haoyan 1:8c48fb8ca5e0 43
haoyan 1:8c48fb8ca5e0 44 int _height;
haoyan 1:8c48fb8ca5e0 45
haoyan 1:8c48fb8ca5e0 46 int _width;
haoyan 1:8c48fb8ca5e0 47
haoyan 1:8c48fb8ca5e0 48 int _speed;
haoyan 1:8c48fb8ca5e0 49
haoyan 1:8c48fb8ca5e0 50 int _score;
haoyan 1:8c48fb8ca5e0 51
haoyan 1:8c48fb8ca5e0 52 int _life;
haoyan 1:8c48fb8ca5e0 53 };
haoyan 1:8c48fb8ca5e0 54 #endif
haoyan 1:8c48fb8ca5e0 55
haoyan 1:8c48fb8ca5e0 56
haoyan 1:8c48fb8ca5e0 57
haoyan 1:8c48fb8ca5e0 58
haoyan 1:8c48fb8ca5e0 59