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.cpp@2:8410e09b77aa, 2017-03-18 (annotated)
- Committer:
- Nathanj94
- Date:
- Sat Mar 18 14:06:17 2017 +0000
- Revision:
- 2:8410e09b77aa
- Parent:
- 1:43fbcc3584d6
- Child:
- 3:fc9133faec7a
functions added to check if the object is caught in the basket or not, unfinished
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nathanj94 | 0:8d02400f792a | 1 | #include "Catch_Model.h" |
Nathanj94 | 0:8d02400f792a | 2 | |
Nathanj94 | 0:8d02400f792a | 3 | Catch_Model::Catch_Model() |
Nathanj94 | 0:8d02400f792a | 4 | { |
Nathanj94 | 0:8d02400f792a | 5 | |
Nathanj94 | 0:8d02400f792a | 6 | } |
Nathanj94 | 0:8d02400f792a | 7 | |
Nathanj94 | 0:8d02400f792a | 8 | Catch_Model::~Catch_Model() |
Nathanj94 | 0:8d02400f792a | 9 | { |
Nathanj94 | 0:8d02400f792a | 10 | |
Nathanj94 | 0:8d02400f792a | 11 | } |
Nathanj94 | 0:8d02400f792a | 12 | |
Nathanj94 | 1:43fbcc3584d6 | 13 | void Catch_Model::init(int basket_y, int basket_width, int objects_speed) |
Nathanj94 | 0:8d02400f792a | 14 | { |
Nathanj94 | 0:8d02400f792a | 15 | _basket_y = basket_y; |
Nathanj94 | 0:8d02400f792a | 16 | _basket_width = basket_width; |
Nathanj94 | 0:8d02400f792a | 17 | |
Nathanj94 | 1:43fbcc3584d6 | 18 | _objects_speed = objects_speed; |
Nathanj94 | 1:43fbcc3584d6 | 19 | |
Nathanj94 | 0:8d02400f792a | 20 | _basket.Basket_init(_basket_y, _basket_width); |
Nathanj94 | 1:43fbcc3584d6 | 21 | _objects.Objects_init(_objects_speed); |
Nathanj94 | 0:8d02400f792a | 22 | } |
Nathanj94 | 0:8d02400f792a | 23 | |
Nathanj94 | 0:8d02400f792a | 24 | void Catch_Model::input(Gamepad &pad) |
Nathanj94 | 0:8d02400f792a | 25 | { |
Nathanj94 | 0:8d02400f792a | 26 | _d = pad.get_direction(); |
Nathanj94 | 0:8d02400f792a | 27 | _mag = pad.get_mag(); |
Nathanj94 | 0:8d02400f792a | 28 | } |
Nathanj94 | 0:8d02400f792a | 29 | |
Nathanj94 | 0:8d02400f792a | 30 | void Catch_Model::update(Gamepad &pad) |
Nathanj94 | 0:8d02400f792a | 31 | { |
Nathanj94 | 1:43fbcc3584d6 | 32 | _basket.Basket_move(_d, _mag); |
Nathanj94 | 1:43fbcc3584d6 | 33 | _objects.Objects_move(); |
Nathanj94 | 0:8d02400f792a | 34 | } |
Nathanj94 | 0:8d02400f792a | 35 | |
Nathanj94 | 0:8d02400f792a | 36 | void Catch_Model::draw(N5110 &lcd) |
Nathanj94 | 0:8d02400f792a | 37 | { |
Nathanj94 | 0:8d02400f792a | 38 | _basket.Basket_draw(lcd); |
Nathanj94 | 1:43fbcc3584d6 | 39 | _objects.Objects_draw(lcd); |
Nathanj94 | 2:8410e09b77aa | 40 | } |
Nathanj94 | 2:8410e09b77aa | 41 | |
Nathanj94 | 2:8410e09b77aa | 42 | void Catch_Model::check_basket_catch(N5110 &lcd) |
Nathanj94 | 2:8410e09b77aa | 43 | { |
Nathanj94 | 2:8410e09b77aa | 44 | |
Nathanj94 | 2:8410e09b77aa | 45 | } |
Nathanj94 | 2:8410e09b77aa | 46 | |
Nathanj94 | 2:8410e09b77aa | 47 | void Catch_Model::check_basket_miss(N5110 &lcd) |
Nathanj94 | 2:8410e09b77aa | 48 | { |
Nathanj94 | 2:8410e09b77aa | 49 | |
Nathanj94 | 1:43fbcc3584d6 | 50 | } |