class for obstacles in Car_race game
Obstacles.h@10:515df7535b2f, 2017-05-02 (annotated)
- Committer:
- fy14aaz
- Date:
- Tue May 02 22:25:19 2017 +0000
- Revision:
- 10:515df7535b2f
- Parent:
- 9:d5f90988545e
- Child:
- 11:c0922d4fda7b
polishing the code, encapsulating the functions into smaller ones and added the instructions part
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fy14aaz | 0:f8968ec0ec1b | 1 | #ifndef OBSTACLES_H |
fy14aaz | 0:f8968ec0ec1b | 2 | #define OBSTACLES_H |
fy14aaz | 0:f8968ec0ec1b | 3 | |
fy14aaz | 0:f8968ec0ec1b | 4 | #include "mbed.h" |
fy14aaz | 0:f8968ec0ec1b | 5 | #include "N5110.h" |
fy14aaz | 0:f8968ec0ec1b | 6 | #include "Gamepad.h" |
fy14aaz | 0:f8968ec0ec1b | 7 | |
fy14aaz | 0:f8968ec0ec1b | 8 | class Obstacles |
fy14aaz | 0:f8968ec0ec1b | 9 | |
fy14aaz | 0:f8968ec0ec1b | 10 | { |
fy14aaz | 0:f8968ec0ec1b | 11 | |
fy14aaz | 0:f8968ec0ec1b | 12 | public: |
fy14aaz | 0:f8968ec0ec1b | 13 | |
fy14aaz | 0:f8968ec0ec1b | 14 | Obstacles(); |
fy14aaz | 0:f8968ec0ec1b | 15 | ~Obstacles(); |
fy14aaz | 0:f8968ec0ec1b | 16 | |
fy14aaz | 0:f8968ec0ec1b | 17 | void init(int seed); |
fy14aaz | 1:a735e7396af4 | 18 | void draw(N5110 &lcd,int seed); |
fy14aaz | 1:a735e7396af4 | 19 | void update(N5110 &lcd); |
fy14aaz | 8:c8007ccac5c0 | 20 | void addScore(N5110 &lcd); |
fy14aaz | 10:515df7535b2f | 21 | void updateScore(); |
fy14aaz | 8:c8007ccac5c0 | 22 | int getScore(); |
fy14aaz | 9:d5f90988545e | 23 | int getTotalScore(); |
fy14aaz | 0:f8968ec0ec1b | 24 | |
fy14aaz | 0:f8968ec0ec1b | 25 | private: |
fy14aaz | 0:f8968ec0ec1b | 26 | |
fy14aaz | 1:a735e7396af4 | 27 | |
fy14aaz | 0:f8968ec0ec1b | 28 | int _Obstacle_x; |
fy14aaz | 8:c8007ccac5c0 | 29 | int _score; |
fy14aaz | 9:d5f90988545e | 30 | int _totalscore; |
fy14aaz | 0:f8968ec0ec1b | 31 | }; |
fy14aaz | 0:f8968ec0ec1b | 32 | |
fy14aaz | 0:f8968ec0ec1b | 33 | #endif |