Game for Leeds University Gamepad for the FRDM-K64F: Game is a RPG Horror Title.

Dependencies:   mbed FATFileSystem

Revision:
13:95323e0f2fcb
Parent:
12:ff8d26124c38
Child:
14:165fff6d1854
--- a/SceneCreator/SceneCreator.cpp	Sun May 05 19:32:58 2019 +0000
+++ b/SceneCreator/SceneCreator.cpp	Mon May 06 02:40:07 2019 +0000
@@ -1,56 +1,69 @@
 #include "SceneCreator.h"
 #include "ScenePaths.h"
 
+//Timer for dynamic wait times to reduce notice-able lagging between scenes
 Timer dynatime;
 
 DigitalOut led(LED_BLUE);
 Serial pc(USBTX,USBRX);
 
+//Constructor
 SceneCreator::SceneCreator(PinName Button) {
     this->set_buttonPin(Button);
     dead = false;
     
 }
 
+//Destructor
 SceneCreator::~SceneCreator() {
    this->deletebutton();
 }
 
+//Primary Function
 void SceneCreator::Scenesp(N5110 &lcd, CaMove &CM,short int spl,short int spx,short int spy, Direction spd, int rng,WDplayer &wav) {
+    //Setting up WDplayer, CaMove and Scene interative regions
     wav.ISRset();
     CM.init(spx,spy,spd);
     CM.AIinit();
     lcd.normalMode();
     this->set_sreg(CM,spl);
+    //Array to allow Pos Events to disable or enable Pre Events
     bool p[6] = {true,true,true,true,true,true};
+    //Main Loop exit if charater dead or leaves screen
     while(!dead && CM.in_screen()) {
+        //start timer
         dynatime.start();
         lcd.clear();
+        //reload WDplayer data then Load map data
         wav.ISRpreload();
         Bitmap::renderBMP(SCN[spl],lcd,0,0);
-        //CORE_1
+        //CORE_1 (Pre Events Engine)
         this->Core_1(lcd, CM,spl,rng,p);
+        //Charater and Chaser Model Update
         CM.move(lcd);
         CM.chase(lcd,spl);
         wav.ISRpreload();
-        //CORE_2
+        //CORE_2 (Pos Event Engine)
         this->Core_2(lcd, CM,spl,rng,p,wav);
         if (CM.is_caught()) {
             dead = true;
         }
         lcd.refresh();
+        //Dynamic Wait
         dynatime.stop();
         float waittime = 0.15f - dynatime.read();
-        pc.printf("%f\n",waittime);
         if (waittime > 0.00000f) {
             wait(waittime);
         }
         dynatime.reset();
+        //Will aim for 7 frames per second if too heavy of performance impacting frame rate will drop
     };
+    //reset WDplayer and Delete interative regions
     wav.ISRreset();
     CM.delete_regions();
 };
 
+//CORE_1 (Pre EVENTS)
 void SceneCreator::Core_1(N5110 &lcd, CaMove &CM,short int spl,int rng,bool p[6]) {
     if (p[0]) {
             this->pre_func0(spl,lcd,CM,rng);
@@ -72,17 +85,24 @@
         }
 }
 
+//CORE_2 (Pos EVENTs)
 void SceneCreator::Core_2(N5110 &lcd, CaMove &CM,short int spl,int rng,bool (&p)[6],WDplayer &wav) {
+    //Checks which region triggered
     switch(CM.get_treg()) {
             case 0:
+                //pause Music
                 wav.ISRpause();
+                //Signal to player he is progressing by flashing screen (only occurs once)
                 if(p[0]) {
                     p[0] *= false;
                     this->flash(lcd);
                 }
+                //Do this
                 this->pos_func0(spl,lcd,CM,rng);
+                //Resume Music
                 wav.ISRresume();
             break;
+            //Same For All Cases
             case 1:
                 wav.ISRpause();
                 if(p[1]) {
@@ -132,6 +152,8 @@
 }
 
 //settings
+//All below Functions Check which scene is operating and then fetches the required Function from SceneFunctions
+//They all are they same...
 void SceneCreator::set_sreg(CaMove &CM,int sce) {
     switch(sce) {
         case 0:
@@ -151,7 +173,6 @@
     }
 }
 
-//Function Pointers Failing mbed in-capable
 //pre-func
 void SceneCreator::pre_func0(int sce,N5110 &lcd,CaMove &CM,int rng) {
     switch(sce) {