问题描述
我電腦端取得0.332422,0.9323232,0.323232我把她轉換成0.3324220.93232320.323232我要把0.332422判斷<0會按W>0會按S0.9323232判斷<0會按A>0會按D這樣doubleq[]={0,1,2};try{Robotrobot=newRobot();while(true)//线程无限循环,实时监听socket端口{client=ResponseSocket();//响应客户端链接请求。。while(true){txt=ReceiveMsg(client);String[]va=txt.split(",");for(intx=0;x<va.length;x++){System.out.print(va[x]+"n");if(Double.parseDouble(va[x])<q[0]){robot.keyPress(KeyEvent.VK_W);}elseif(Double.parseDouble(va[x])>q[0]){robot.keyPress(KeyEvent.VK_S);}}
时间: 2024-10-05 09:01:41