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

Committer:
Nathanj94
Date:
Fri Apr 14 15:37:08 2017 +0000
Revision:
8:db24c475f64f
Parent:
7:ec6dc66ee196
Child:
9:902b67101cdc
Time delays for button presses working, now only one action can be used every 10s. An indicator at the top of the screen shows if this is available (tick/cross). New button function adds an extra live to add longevity to a game. Started trying tones.

Who changed what in which revision?

UserRevisionLine numberNew 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 8:db24c475f64f 22
Nathanj94 3:fc9133faec7a 23 void check_basket_catch(N5110 &lcd, Gamepad &pad);
Nathanj94 3:fc9133faec7a 24 void check_basket_miss(N5110 &lcd, Gamepad &pad);
Nathanj94 8:db24c475f64f 25
Nathanj94 8:db24c475f64f 26 void check_a(N5110 &lcd, Gamepad &pad);
Nathanj94 8:db24c475f64f 27 void check_b(N5110 &lcd, Gamepad &pad);
Nathanj94 7:ec6dc66ee196 28 void set_delay();
Nathanj94 8:db24c475f64f 29
Nathanj94 5:7db3e43e5aca 30 void add_score();
Nathanj94 4:84e29254b988 31 int get_lives();
Nathanj94 8:db24c475f64f 32
Nathanj94 4:84e29254b988 33 void print_lives(N5110 &lcd);
Nathanj94 3:fc9133faec7a 34 void print_score(N5110 &lcd);
Nathanj94 8:db24c475f64f 35 void print_delay(N5110 &lcd);
Nathanj94 0:8d02400f792a 36
Nathanj94 0:8d02400f792a 37 private:
Nathanj94 0:8d02400f792a 38
Nathanj94 4:84e29254b988 39 Basket basket;
Nathanj94 4:84e29254b988 40 Objects objects;
Nathanj94 7:ec6dc66ee196 41 ABXY abxy;
Nathanj94 7:ec6dc66ee196 42 Timeout timeout;
Nathanj94 0:8d02400f792a 43
Nathanj94 0:8d02400f792a 44 int _basket_y;
Nathanj94 0:8d02400f792a 45 int _basket_width;
Nathanj94 1:43fbcc3584d6 46 int _objects_speed;
Nathanj94 4:84e29254b988 47 int _lives;
Nathanj94 7:ec6dc66ee196 48 int _delay;
Nathanj94 2:8410e09b77aa 49
Nathanj94 0:8d02400f792a 50 Direction _d;
Nathanj94 0:8d02400f792a 51 float _mag;
Nathanj94 0:8d02400f792a 52
Nathanj94 0:8d02400f792a 53 };
Nathanj94 0:8d02400f792a 54 #endif