Li Ruofan 201199450

Dependencies:   mbed

Revision:
0:80a59a49d504
Child:
1:bd7c99a5bd10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Snake/Snake.h	Sat May 23 19:01:15 2020 +0000
@@ -0,0 +1,89 @@
+#ifndef SNAKE_H
+#define SNAKE_H
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+
+/*
+ELEC2645 Embedded Systems Project
+School of Electronic & Electrical Engineering
+University of Leeds
+Name: Ruofan Li
+Username: el17rl
+Student ID Number: 201199450
+Date: May, 2020
+*/
+
+/* set position */
+
+struct Body{       
+         
+    char bodyX[5000];
+    char bodyY[5000];
+    char _Joystick[5000]; 
+
+    };
+
+struct pos{     
+    int x;         
+    int y;         
+    
+    };  
+
+class Snake{
+    
+
+    public:
+    
+ 
+      
+        /** Set the initial parameters of the project
+         */
+        void init(int _x, int _y, int _L,int _life);
+        
+        void draw(N5110 &lcd);
+        
+        void update(Gamepad &pad);
+        
+        void death(N5110 &lcd);
+        
+        void produceBody();
+        
+        void changeDir(Gamepad &pad);
+        
+        void press(Gamepad &pad);
+        
+        void WallMeet(N5110 &lcd);
+        
+        void checkBodyMeet(N5110 &lcd);
+        
+        bool eatApple();
+        
+        /** Constructor */
+        Snake();
+        
+        /** Destructor */
+        ~Snake();
+        
+        int L;             
+        
+        int Life;      
+
+        void drawApple(N5110 &lcd);
+        
+        void produceApple();
+        
+        void initApple();
+        
+        pos getPos();
+       
+    private:
+    
+        int _direction;
+        int beginX;     
+        int beginY;   
+        int beginL;   
+        Direction d;
+};
+#endif
\ No newline at end of file