Jirat

Dependencies:   mbed

Fork of project by Nasrun Hayeeyama

Revision:
12:287c6a9560ca
Parent:
11:305164107874
Child:
13:eee9af3b4308
--- a/main.cpp	Sat Dec 03 08:40:28 2016 +0000
+++ b/main.cpp	Sat Dec 03 09:06:18 2016 +0000
@@ -97,19 +97,24 @@
         }else{
             if(enemy_ready!=1){
                 printf("sent E\n");
-                while(uli<1000){
+                while(uli<50){
                     bt.printf("E");
                     uli++;
                 }
+            }else{
+                bt.putc('l');
             }
             printf("\n");
             break;
         }
     }
+    if(enemy_ready == 0){
+        printf("Wait for enemy\n");
+        while(1){if(bt.readable()){if(bt.getc()=='l'){break;}}}
+        state = 0;
+    }else{state = 1;}
+    while(1) { //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Play
     select_Position = 0;
-    printf("%d",enemy_ready);
-    if(enemy_ready == 1){state = 1;}else{state = 0;}
-    while(1) { //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Play
         if(state == 0){
             atk_enemy();
             printf("This is enemy_platform.\n");
@@ -301,7 +306,6 @@
                 for(j=0;j<15;j++){
                     if(ship4[i]==ship_underATK[j]){
                         ship_destroyed[0]++;
-                        printf("%d || %d : %d\n",ship_destroyed[0],ship4[i],ship_underATK[j]);
                     }
                 }
             }