el16ccn_maze

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
el16ccn
Date:
Tue May 08 14:42:55 2018 +0000
Parent:
9:73888767b4db
Commit message:
final; re-do

Changed in this revision

Maze/Maze.cpp Show annotated file Show diff for this revision Revisions of this file
Visuals/Visuals.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Maze/Maze.cpp	Tue May 08 14:17:41 2018 +0000
+++ b/Maze/Maze.cpp	Tue May 08 14:42:55 2018 +0000
@@ -73,24 +73,26 @@
     _mazeModel = mazeModel;
 }
 
+
+//define maze model as integers
+//set various integers to represent various maze models
 void Maze::draw(N5110 &lcd, Visuals &visual)
 {
     if (_mazeModel == 0){
-        mazeModelZero(lcd,visual);//easy maze
+        mazeModelZero(lcd,visual);//easy maze represented by maze model = 1 
     }
     else if (_mazeModel == 1){
-        mazeModelOne(lcd); //medium maze
+        mazeModelOne(lcd); //medium maze represented by maze model = 2
     }
     else if (_mazeModel == 2){
-        mazeModelTwo(lcd); //hard maze
-    }
-    
-    else if (_mazeModel == 3){
-        mazeModelTwo(lcd); //hard maze
+        mazeModelTwo(lcd); //hard maze represented by maze model = 3
     }
     
 }
 
+
+
+//draw maze needed for easy game level
 void Maze::mazeModelZero(N5110 &lcd, Visuals &visual)
 {
     
@@ -118,6 +120,8 @@
     
 }
 
+
+//draw maze needed for medium maze level 
 void Maze::mazeModelOne(N5110 &lcd)
 {
     //int w = 14;
@@ -137,19 +141,24 @@
     lcd.drawLine(58, 11, 84, 11, FILL_BLACK);
     lcd.drawLine(58, 11, 58, 35, FILL_BLACK);
     lcd.drawLine(70, 22, 70, 48, FILL_BLACK);
-    
-  
-  //  lcd.drawSprite(w,0,48,56,(int *)check);
  
         wait(0.1); 
     
 }
 
+
+//Draw maze model two for hard game level
 void Maze::mazeModelTwo(N5110 &lcd)
 {
     
 
-    lcd.drawRect(2, 1, 82, 46, FILL_TRANSPARENT);
+    
+    lcd.drawLine(0, 0, 0, 48, FILL_BLACK);
+    lcd.drawLine(0, 47, 82, 47, FILL_BLACK);
+    lcd.drawLine(0, 0, 82, 0, FILL_BLACK);
+    lcd.drawLine(82, 0, 82, 30, FILL_BLACK);
+    lcd.drawLine(82, 47, 82, 36, FILL_BLACK);
+
     lcd.drawLine(12, 1, 12, 11, FILL_BLACK);
     lcd.drawLine(52, 1, 52, 16, FILL_BLACK);
     lcd.drawLine(67, 1, 67, 11, FILL_BLACK);
@@ -203,10 +212,4 @@
     lcd.drawLine(37, 41, 52, 41, FILL_BLACK);
     lcd.drawLine(62, 41, 77, 41, FILL_BLACK);
     lcd.drawLine(27, 41, 27, 45, FILL_BLACK);
-    
-    for (int j = 2; j < 6; j++){
-        lcd.clearPixel(83, j);
-    }
-    
-
 }
\ No newline at end of file
--- a/Visuals/Visuals.cpp	Tue May 08 14:17:41 2018 +0000
+++ b/Visuals/Visuals.cpp	Tue May 08 14:42:55 2018 +0000
@@ -12,7 +12,8 @@
 }
 
 
-
+//intro function
+//animates on lcd until start is pressed
 void Visuals::intro(N5110 &lcd, Gamepad &pad)
 {
      lcd.clear();
@@ -24,7 +25,8 @@
 }
 
 
-
+//maze explored function
+//animates screen when maze has been completed
 void Visuals::mazeExplored(N5110 &lcd, Gamepad &pad)
 {
     lcd.printString("  MAZE", 0, 2);
@@ -41,7 +43,8 @@
 }
 
 
-
+//game over function
+//animates screen on the event that the ball collides with object in medium maze level
 void Visuals::mazeOver(N5110 &lcd, Gamepad &pad)
 {
     lcd.printString("  GAME", 0, 2);
@@ -60,7 +63,9 @@
     
 }
 
-
+//audio switch funtion
+//animates screen when audio settings are selected
+//shows switch to select if sound is on or off
 void Visuals::audioSwitch(N5110 &lcd, Gamepad &pad, bool tone)
 {
  int exit = 0;