Jirat

Dependencies:   mbed

Fork of project by Nasrun Hayeeyama

Revision:
18:ecef8382d41e
Parent:
17:aeb7cbfb8640
Child:
19:d78586719868
--- a/main.cpp	Sat Dec 03 15:26:17 2016 +0000
+++ b/main.cpp	Sat Dec 03 15:48:37 2016 +0000
@@ -59,8 +59,8 @@
     bt.baud(9600);
     float Vx;
     float Vy;
-    int SW,iVxVy,iSW,n;
-    unsigned long int uli = 0;
+    int SW,iVxVy,iSW,n,check_win = 0;
+    int uli = 0;
     char m;
     
     while(1) {
@@ -123,7 +123,8 @@
             atk_enemy();
             printf("This is enemy_platform.\n");
             print_enemy_platform();
-            if(IamWin()==1){printf("You win!\n");}else{state = 1;}
+            check_win = IamWin();
+            if(check_win==1){printf("You win!\n");break;}else{state = 1;}
         }else{
             enemy_atk();
             printf("This is atk_platform.\n");
@@ -447,7 +448,7 @@
 int IamWin(){
     char chare;
     if(bt.readable()){
-        chare = bt.getc()
+        chare = bt.getc();
         if(chare=='q'){return 1;}else{return 0;}
     }else{return 0;}
 }
\ No newline at end of file