Laser tag guns code https://os.mbed.com/users/ddakev/notebook/laser-tag-system/

Dependencies:   mbed 4DGL-uLCD-SE PinDetect SoftI2C

Files at this revision

API Documentation at this revision

Comitter:
ddakev
Date:
Mon Apr 22 17:40:30 2019 +0000
Parent:
0:4c644bb83761
Commit message:
Bug fixes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4c644bb83761 -r 7d957da791a5 main.cpp
--- a/main.cpp	Sun Apr 21 15:48:44 2019 +0000
+++ b/main.cpp	Mon Apr 22 17:40:30 2019 +0000
@@ -201,7 +201,7 @@
     }
     else if(gameState == RUNNING && !dead) {
         if(bullets > 0) {
-            IR.putc('0');   // change to xbeeId
+            IR.putc(xbeeId + '0');   // change to xbeeId
             bullets--;
             redraw_bullets();
             sound_i = 0;
@@ -332,6 +332,7 @@
         case ENDED:
             gameState = ENDED;
             clear_footer();
+            message_timeout.detach();
             redraw_middle_message("Game Ended");
             greenLED = 1;
             redLED = 0;
@@ -444,6 +445,7 @@
                         }
                         index++;
                     }
+                    shooteeName[nameIndex] = '\0';
                     if(shooterId == xbeeId) {
                         char msg[80];
                         strcpy(msg, "You shot ");