Uses accompanying Basket, Objects and Fruit libraries to create Fruit Basket game. If an object is caught, points are added; if an object in missed, a 'life' is lost.
Dependents: Game_Controller_Project
Catch_Model.h@5:7db3e43e5aca, 2017-03-31 (annotated)
- Committer:
- Nathanj94
- Date:
- Fri Mar 31 13:44:48 2017 +0000
- Revision:
- 5:7db3e43e5aca
- Parent:
- 4:84e29254b988
- Child:
- 6:61bcf98e0a88
New method called add_score which uses the variable set in Objects to call the correct method from Basket
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nathanj94 | 0:8d02400f792a | 1 | #ifndef CATCH_MODEL_H |
Nathanj94 | 0:8d02400f792a | 2 | #define CATCH_MODEL_H |
Nathanj94 | 0:8d02400f792a | 3 | |
Nathanj94 | 0:8d02400f792a | 4 | #include "mbed.h" |
Nathanj94 | 0:8d02400f792a | 5 | #include "N5110.h" |
Nathanj94 | 0:8d02400f792a | 6 | #include "Gamepad.h" |
Nathanj94 | 0:8d02400f792a | 7 | #include "Basket.h" |
Nathanj94 | 1:43fbcc3584d6 | 8 | #include "Objects.h" |
Nathanj94 | 0:8d02400f792a | 9 | |
Nathanj94 | 0:8d02400f792a | 10 | class Catch_Model |
Nathanj94 | 0:8d02400f792a | 11 | { |
Nathanj94 | 0:8d02400f792a | 12 | public: |
Nathanj94 | 0:8d02400f792a | 13 | |
Nathanj94 | 0:8d02400f792a | 14 | Catch_Model(); |
Nathanj94 | 0:8d02400f792a | 15 | ~Catch_Model(); |
Nathanj94 | 0:8d02400f792a | 16 | |
Nathanj94 | 4:84e29254b988 | 17 | void init(int basket_y, int basket_width, int objects_speed, int lives); |
Nathanj94 | 0:8d02400f792a | 18 | void input(Gamepad &pad); |
Nathanj94 | 3:fc9133faec7a | 19 | void update(N5110 &lcd, Gamepad &pad); |
Nathanj94 | 0:8d02400f792a | 20 | void draw(N5110 &lcd); |
Nathanj94 | 3:fc9133faec7a | 21 | void check_basket_catch(N5110 &lcd, Gamepad &pad); |
Nathanj94 | 3:fc9133faec7a | 22 | void check_basket_miss(N5110 &lcd, Gamepad &pad); |
Nathanj94 | 5:7db3e43e5aca | 23 | void add_score(); |
Nathanj94 | 4:84e29254b988 | 24 | int get_lives(); |
Nathanj94 | 4:84e29254b988 | 25 | void print_lives(N5110 &lcd); |
Nathanj94 | 3:fc9133faec7a | 26 | void print_score(N5110 &lcd); |
Nathanj94 | 2:8410e09b77aa | 27 | |
Nathanj94 | 0:8d02400f792a | 28 | |
Nathanj94 | 0:8d02400f792a | 29 | private: |
Nathanj94 | 0:8d02400f792a | 30 | |
Nathanj94 | 4:84e29254b988 | 31 | Basket basket; |
Nathanj94 | 4:84e29254b988 | 32 | Objects objects; |
Nathanj94 | 0:8d02400f792a | 33 | |
Nathanj94 | 0:8d02400f792a | 34 | int _basket_y; |
Nathanj94 | 0:8d02400f792a | 35 | int _basket_width; |
Nathanj94 | 1:43fbcc3584d6 | 36 | int _objects_speed; |
Nathanj94 | 4:84e29254b988 | 37 | int _lives; |
Nathanj94 | 2:8410e09b77aa | 38 | |
Nathanj94 | 0:8d02400f792a | 39 | Direction _d; |
Nathanj94 | 0:8d02400f792a | 40 | float _mag; |
Nathanj94 | 0:8d02400f792a | 41 | |
Nathanj94 | 0:8d02400f792a | 42 | }; |
Nathanj94 | 0:8d02400f792a | 43 | #endif |