Esempio n. 1
0
  public void spawn(int n) {
    if (n == spawnLoc) return;

    if (n != -1) {
      Action a = new Action(playerId, Action.SPAWN, "" + n);
      tcp.sendSocket(prot.encodeAction(a));
    }
    spawnLoc = n;
  }
Esempio n. 2
0
  public void move(Action a) {
    if (input.equals(a)) // if performance is still good leave this commented
    return;
    // This is not a performance issue, this is an issue when someone presses a key
    // and holds it, since it's the same "input", we only send it once to the server
    // and not every frame at 90fps, which tcp sender can't handle anyway.

    tcp.sendSocket(prot.encodeAction(a));
    input.copy(a);
  }
Esempio n. 3
0
 public void shoot(Vector2D Spot) {
   Action shooty = new Action(playerId, Action.SHOOT, Spot);
   tcp.sendSocket(prot.encodeAction(shooty));
 }
Esempio n. 4
0
 public void join(String ip) {
   Action join = new Action(playerId, Action.JOIN_REQUEST, tcp.getMyIP());
   tcp.sendSocket(prot.encodeAction(join));
 }