Jahanzeb Ahmed Khan 201375614
Embed:
(wiki syntax)
Show/hide line numbers
body.h
00001 #ifndef BODY_H 00002 #define BODY_H 00003 00004 #include "mbed.h" 00005 #include "Gamepad.h" 00006 #include "N5110.h" 00007 #include "food.h" 00008 00009 class Body 00010 { 00011 00012 public: 00013 00014 /** Constructor */ 00015 Body(); 00016 00017 /** Destructor */ 00018 ~Body(); 00019 00020 /** Initialises body of snake */ 00021 void init(); 00022 00023 /** checks if user has lost the game */ 00024 void game_end(N5110 &lcd); 00025 00026 /** removes the historical location of pixels to depict movement */ 00027 void trail_delete(N5110 &lcd); 00028 00029 /** takes input from userfor movement */ 00030 void user_input(Gamepad &pad); 00031 00032 /** alters direction of snake based on input */ 00033 void movement(); 00034 00035 /** sets a visual verson of the snake on the pad */ 00036 void visual(N5110 &lcd, Gamepad &pad, Food &food); 00037 00038 /** checks if previous food has been consumed */ 00039 void food_eaten(N5110 &lcd, Gamepad &pad, Food &food); 00040 00041 00042 /** defines button input on gamepad */ 00043 enum Input { 00044 Button_top, 00045 Button_bottom, 00046 Button_right, 00047 Button_left, 00048 }; 00049 00050 int score_display(); 00051 int score; 00052 00053 bool endgame_check(); 00054 bool endgame; 00055 00056 int sx0; 00057 int sx1; 00058 int sx2; 00059 int sx3; 00060 int sx4; 00061 int sx5; 00062 int sx6; 00063 int sx7; 00064 int sx8; 00065 int sx9; 00066 int sy0; 00067 int sy1; 00068 int sy2; 00069 int sy3; 00070 int sy4; 00071 int sy5; 00072 int sy6; 00073 int sy7; 00074 int sy8; 00075 int sy9; 00076 00077 Input input_check; 00078 00079 private: 00080 00081 00082 }; 00083 00084 #endif 00085 00086 00087 00088 00089 00090 00091
Generated on Thu Aug 4 2022 17:12:13 by
1.7.2