Snake game snake library
Embed:
(wiki syntax)
Show/hide line numbers
Snake.h
00001 #ifndef SNAKE_H 00002 #define SNAKE_H 00003 00004 00005 #include "mbed.h" 00006 #include "N5110.h" 00007 #include "Gamepad.h" 00008 #include "Food.h" 00009 /************************Structs************************/ 00010 struct snakePart{ 00011 char _x[4000]; 00012 char _y[4000]; 00013 char _dirc[4000]; 00014 00015 }; 00016 00017 /************************Class Def************************/ 00018 00019 class Snake{ 00020 00021 /************************Public Vars************************/ 00022 public: 00023 00024 Snake(); 00025 ~Snake(); 00026 void init(int x, int y, int lenght,int _live); 00027 void drawsnake(N5110 &lcd, Gamepad &pad); 00028 void snakemov(Gamepad &pad); 00029 int dead(N5110 &lcd, Gamepad &pad); 00030 void eat(Gamepad &pad); 00031 void check_WallCollision(N5110 &lcd, Gamepad &pad); 00032 void check_TailCollision(N5110 &lcd, Gamepad &pad); 00033 void drawscore(N5110 &lcd); 00034 void Tone_1(Gamepad &pad); 00035 void game_music(Gamepad &pad); 00036 int _length; 00037 int live; 00038 float waitTime; 00039 float waitExpect; 00040 int _speed; 00041 int Highest_score; 00042 00043 00044 00045 /************************Private Vars************************/ 00046 private: 00047 00048 int _direction; 00049 int initx; 00050 int inity; 00051 int initl; 00052 int x; 00053 Direction d; 00054 Food _food; 00055 00056 00057 }; 00058 00059 #endif
Generated on Wed Jul 13 2022 05:25:14 by
1.7.2