Add sprint command

master
sigonasr2 2 years ago
parent fb07e64410
commit 7b43df3b6f
  1. 28
      sig/App.java

@ -29,6 +29,7 @@ class Client {
private DataOutputStream out = null; private DataOutputStream out = null;
private static boolean run = true; private static boolean run = true;
boolean altHeld=false;
// constructor to put ip address and port // constructor to put ip address and port
public Client(String address, int port) public Client(String address, int port)
{ {
@ -40,7 +41,6 @@ class Client {
} }
keyboardHook.addKeyListener(new GlobalKeyAdapter() { keyboardHook.addKeyListener(new GlobalKeyAdapter() {
@Override @Override
public void keyPressed(GlobalKeyEvent event) { public void keyPressed(GlobalKeyEvent event) {
try { try {
@ -48,6 +48,9 @@ class Client {
case GlobalKeyEvent.VK_NUMPAD7:{ case GlobalKeyEvent.VK_NUMPAD7:{
out.writeUTF("FOLLOW"); out.writeUTF("FOLLOW");
}break; }break;
case 187:{
out.writeUTF("SPRINT");
}break;
case GlobalKeyEvent.VK_NUMPAD8: case GlobalKeyEvent.VK_NUMPAD8:
case GlobalKeyEvent.VK_UP:{ case GlobalKeyEvent.VK_UP:{
out.writeUTF("FORWARD"); out.writeUTF("FORWARD");
@ -66,9 +69,15 @@ class Client {
}break; }break;
case GlobalKeyEvent.VK_NUMPAD1: case GlobalKeyEvent.VK_NUMPAD1:
case GlobalKeyEvent.VK_1: case GlobalKeyEvent.VK_1:
case GlobalKeyEvent.VK_2: case GlobalKeyEvent.VK_2:{
out.writeUTF("FIGHT");
}break;
case GlobalKeyEvent.VK_3:{ case GlobalKeyEvent.VK_3:{
if (altHeld){
out.writeUTF("FIGHTAOE");
} else {
out.writeUTF("FIGHT"); out.writeUTF("FIGHT");
}
}break; }break;
case GlobalKeyEvent.VK_Z: case GlobalKeyEvent.VK_Z:
case GlobalKeyEvent.VK_X:{ case GlobalKeyEvent.VK_X:{
@ -83,6 +92,12 @@ class Client {
case GlobalKeyEvent.VK_NUMPAD9:{ case GlobalKeyEvent.VK_NUMPAD9:{
out.writeUTF("PASS"); out.writeUTF("PASS");
}break; }break;
case 18:{
altHeld=true;
}break;
default:{
//System.out.println(event.getVirtualKeyCode());
}
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -94,7 +109,11 @@ class Client {
@Override @Override
public void keyReleased(GlobalKeyEvent event) { public void keyReleased(GlobalKeyEvent event) {
System.out.println(event); switch (event.getVirtualKeyCode()){
case 18:{
altHeld=false;
}break;
}
} }
}); });
@ -349,6 +368,9 @@ class Server
System.out.println("Aya's Health: "+GetAyaHealth()+"%"); System.out.println("Aya's Health: "+GetAyaHealth()+"%");
System.out.println("Target's Health: "+GetTargetHealth()+"%"); System.out.println("Target's Health: "+GetTargetHealth()+"%");
}break; }break;
case "SPRINT":{
r.keyPress(KeyEvent.VK_N);
}break;
case "UPDATE":{ case "UPDATE":{
}break; }break;

Loading…
Cancel
Save