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@7:ec6dc66ee196, 2017-04-12 (annotated)
- Committer:
- Nathanj94
- Date:
- Wed Apr 12 14:46:51 2017 +0000
- Revision:
- 7:ec6dc66ee196
- Parent:
- 6:61bcf98e0a88
- Child:
- 8:db24c475f64f
added to check_abxy function, now an action will be carried out on a button press but it has to be written into check_abxy; it won't call the same commands from a different library. Trying to use a timeout to delay the next use of the function
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 | 6:61bcf98e0a88 | 9 | #include "ABXY.h" |
Nathanj94 | 0:8d02400f792a | 10 | |
Nathanj94 | 0:8d02400f792a | 11 | class Catch_Model |
Nathanj94 | 0:8d02400f792a | 12 | { |
Nathanj94 | 0:8d02400f792a | 13 | public: |
Nathanj94 | 0:8d02400f792a | 14 | |
Nathanj94 | 0:8d02400f792a | 15 | Catch_Model(); |
Nathanj94 | 0:8d02400f792a | 16 | ~Catch_Model(); |
Nathanj94 | 0:8d02400f792a | 17 | |
Nathanj94 | 4:84e29254b988 | 18 | void init(int basket_y, int basket_width, int objects_speed, int lives); |
Nathanj94 | 0:8d02400f792a | 19 | void input(Gamepad &pad); |
Nathanj94 | 3:fc9133faec7a | 20 | void update(N5110 &lcd, Gamepad &pad); |
Nathanj94 | 0:8d02400f792a | 21 | void draw(N5110 &lcd); |
Nathanj94 | 3:fc9133faec7a | 22 | void check_basket_catch(N5110 &lcd, Gamepad &pad); |
Nathanj94 | 3:fc9133faec7a | 23 | void check_basket_miss(N5110 &lcd, Gamepad &pad); |
Nathanj94 | 7:ec6dc66ee196 | 24 | void check_abxy(N5110 &lcd, Gamepad &pad); |
Nathanj94 | 7:ec6dc66ee196 | 25 | void set_delay(); |
Nathanj94 | 5:7db3e43e5aca | 26 | void add_score(); |
Nathanj94 | 4:84e29254b988 | 27 | int get_lives(); |
Nathanj94 | 4:84e29254b988 | 28 | void print_lives(N5110 &lcd); |
Nathanj94 | 3:fc9133faec7a | 29 | void print_score(N5110 &lcd); |
Nathanj94 | 2:8410e09b77aa | 30 | |
Nathanj94 | 0:8d02400f792a | 31 | |
Nathanj94 | 0:8d02400f792a | 32 | private: |
Nathanj94 | 0:8d02400f792a | 33 | |
Nathanj94 | 4:84e29254b988 | 34 | Basket basket; |
Nathanj94 | 4:84e29254b988 | 35 | Objects objects; |
Nathanj94 | 7:ec6dc66ee196 | 36 | ABXY abxy; |
Nathanj94 | 7:ec6dc66ee196 | 37 | Timeout timeout; |
Nathanj94 | 0:8d02400f792a | 38 | |
Nathanj94 | 0:8d02400f792a | 39 | int _basket_y; |
Nathanj94 | 0:8d02400f792a | 40 | int _basket_width; |
Nathanj94 | 1:43fbcc3584d6 | 41 | int _objects_speed; |
Nathanj94 | 4:84e29254b988 | 42 | int _lives; |
Nathanj94 | 7:ec6dc66ee196 | 43 | int _delay; |
Nathanj94 | 2:8410e09b77aa | 44 | |
Nathanj94 | 0:8d02400f792a | 45 | Direction _d; |
Nathanj94 | 0:8d02400f792a | 46 | float _mag; |
Nathanj94 | 0:8d02400f792a | 47 | |
Nathanj94 | 0:8d02400f792a | 48 | }; |
Nathanj94 | 0:8d02400f792a | 49 | #endif |