Jirat

Dependencies:   mbed

Fork of project by Nasrun Hayeeyama

Revision:
13:eee9af3b4308
Parent:
12:287c6a9560ca
Child:
14:8abed4026326
--- a/main.cpp	Sat Dec 03 09:06:18 2016 +0000
+++ b/main.cpp	Sat Dec 03 09:35:39 2016 +0000
@@ -114,7 +114,6 @@
         state = 0;
     }else{state = 1;}
     while(1) { //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Play
-    select_Position = 0;
         if(state == 0){
             atk_enemy();
             printf("This is enemy_platform.\n");
@@ -354,7 +353,8 @@
                 }
             }
         }
-    }else if(ship_destroyed[1]==6){
+    }
+    if(ship_destroyed[1]==6){
         for(i=0;i<8;i++){
             for(j=0;j<8;j++){
                 if(atk_platform[i][j]==3){
@@ -362,13 +362,15 @@
                 }
             }
         }
-    }else if(ship_destroyed[2]==3){
+    }
+    if(ship_destroyed[2]==3){
         for(k=0;k<2;k++){
             i = ship2[0][k]/10;
             j = ship2[0][k]%10;
             atk_platform[i][j] = 11;
         }
-    }else if(ship_destroyed[3]==3){
+    }
+    if(ship_destroyed[3]==3){
         for(k=0;k<2;k++){
             i = ship2[1][k]/10;
             j = ship2[1][k]%10;
@@ -419,6 +421,7 @@
 void enemy_atk(){
     int data_fromEnemy;
     printf("Wait for enemy attack.\n");
+    select_Position = 0;
     while(1){
         if(bt.readable()){
             data_fromEnemy = char2posit(bt.getc());