Owen Cavender 201159294

Dependencies:   mbed Gamepad2

Committer:
el17oc
Date:
Thu May 28 15:02:30 2020 +0000
Revision:
6:bf90044188d0
Parent:
5:d716013c6a18
Child:
8:997f90c88246
static snake

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17oc 1:897160a1a3ae 1
el17oc 1:897160a1a3ae 2 #ifndef SNAKE_H
el17oc 1:897160a1a3ae 3 #define SNAKE_H
el17oc 1:897160a1a3ae 4
el17oc 1:897160a1a3ae 5 #include "mbed.h"
el17oc 1:897160a1a3ae 6 #include "N5110.h"
el17oc 1:897160a1a3ae 7 #include "Gamepad.h"
el17oc 6:bf90044188d0 8 #include "Apple.h"
el17oc 1:897160a1a3ae 9
el17oc 1:897160a1a3ae 10
el17oc 1:897160a1a3ae 11 class Snake
el17oc 1:897160a1a3ae 12 {
el17oc 1:897160a1a3ae 13
el17oc 1:897160a1a3ae 14
el17oc 1:897160a1a3ae 15 public:
el17oc 1:897160a1a3ae 16 Snake();
el17oc 1:897160a1a3ae 17 ~Snake();
el17oc 1:897160a1a3ae 18
el17oc 1:897160a1a3ae 19 enum Directions {
el17oc 1:897160a1a3ae 20 up,
el17oc 1:897160a1a3ae 21 down,
el17oc 1:897160a1a3ae 22 left,
el17oc 1:897160a1a3ae 23 right,
el17oc 1:897160a1a3ae 24 null
el17oc 1:897160a1a3ae 25 };
el17oc 1:897160a1a3ae 26
el17oc 6:bf90044188d0 27 void init();
el17oc 6:bf90044188d0 28
el17oc 6:bf90044188d0 29
el17oc 6:bf90044188d0 30 void check_collisions();
el17oc 6:bf90044188d0 31 void check_score(N5110 &lcd, Gamepad &pad, Apple &apple, Timer &timer);
el17oc 6:bf90044188d0 32
el17oc 6:bf90044188d0 33
el17oc 6:bf90044188d0 34
el17oc 6:bf90044188d0 35
el17oc 6:bf90044188d0 36 void get_position(Gamepad &pad);
el17oc 6:bf90044188d0 37 void render(N5110 &lcd, Apple &apple);
el17oc 6:bf90044188d0 38 void get_LEDs(Gamepad &pad);
el17oc 6:bf90044188d0 39 void get_timer(Timer &timer);
el17oc 6:bf90044188d0 40 bool get_gameover();
el17oc 6:bf90044188d0 41 int get_score();
el17oc 6:bf90044188d0 42 void print_scores(N5110 &lcd);
el17oc 6:bf90044188d0 43 void print_display_time(N5110 &lcd);
el17oc 1:897160a1a3ae 44
el17oc 1:897160a1a3ae 45
el17oc 1:897160a1a3ae 46
el17oc 1:897160a1a3ae 47 private:
el17oc 1:897160a1a3ae 48
el17oc 1:897160a1a3ae 49 bool _gameover;
el17oc 1:897160a1a3ae 50 Directions _direction;
el17oc 1:897160a1a3ae 51 int _score;
el17oc 6:bf90044188d0 52
el17oc 6:bf90044188d0 53 float _realtime;
el17oc 6:bf90044188d0 54 int Reset_value;
el17oc 6:bf90044188d0 55 float _display_time;
el17oc 6:bf90044188d0 56
el17oc 6:bf90044188d0 57
el17oc 6:bf90044188d0 58 int _x0;
el17oc 6:bf90044188d0 59 int _x1;
el17oc 6:bf90044188d0 60 int _x2;
el17oc 6:bf90044188d0 61 int _x3;
el17oc 6:bf90044188d0 62
el17oc 6:bf90044188d0 63 int _y0;
el17oc 6:bf90044188d0 64 int _y1;
el17oc 6:bf90044188d0 65 int _y2;
el17oc 6:bf90044188d0 66 int _y3;
el17oc 6:bf90044188d0 67
el17oc 6:bf90044188d0 68 //Vector2D SK0;
el17oc 6:bf90044188d0 69 //Vector2D SK1;
el17oc 6:bf90044188d0 70 //Vector2D SK2;
el17oc 6:bf90044188d0 71 //Vector2D SK3;
el17oc 1:897160a1a3ae 72
el17oc 1:897160a1a3ae 73 };
el17oc 1:897160a1a3ae 74
el17oc 1:897160a1a3ae 75
el17oc 1:897160a1a3ae 76 #endif