My take on the classic Pac man game. Using mbed LPC 1768 and Nokia 5110 LCD Analog joystick used to control direction

Dependencies:   N5110 PowerControl mbed

Revision:
2:830feffe8462
Parent:
1:98cc4f4a20dc
Child:
3:83c1d9cd97f1
--- a/main.cpp	Mon Apr 20 19:38:17 2015 +0000
+++ b/main.cpp	Mon Apr 20 19:44:16 2015 +0000
@@ -17,7 +17,7 @@
 volatile bool gameover=false;   //True when the position of the ghost and pacman are the same
 Ticker pollJoystick; // timer to regularly read the joystick
 int next[84][48]= {0};
-
+int coinflag = 1;
 
 
 enum DirectionName { // create enumerated type (0,1,2,3 etc. for direction)
@@ -74,7 +74,7 @@
     }
 
 
-   
+
 }
 
 void drawMap1()// Furthest Left  Map
@@ -150,8 +150,12 @@
     while(1) {
         lcd.clear();
         drawMap1();
-        lcd.drawCircle(i,j,2,1); //x-coordinate of origin (top-left),y-coordinate of origin (top-left),width , height ,0 transparent (w/outline), 1 filled black, 2 filled white (wo/outline)
-
+        lcd.drawCircle(i,j,3,1); //x-coordinate of origin (top-left),y-coordinate of origin (top-left),width , height ,0 transparent (w/outline), 1 filled black, 2 filled white (wo/outline)
+        
+        
+        if (coinflag==1){
+            lcd.drawCircle(20,20,2,1);
+            }
 
         if (joystick.direction == UP) {
             j--;
@@ -174,6 +178,16 @@
         if (j>43) {
             j=43;
         }
+        if (i==20) {
+            if(j==20) {
+                coinflag=0;
+            }
+        }
+        if( coinflag == 0){
+            lcd.clearPixel(20,20); 
+            }
+
+
 
     }