コード例 #1
0
ファイル: Player.java プロジェクト: rredford/MultiplayerGame
  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;
  }
コード例 #2
0
ファイル: Player.java プロジェクト: rredford/MultiplayerGame
  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);
  }
コード例 #3
0
ファイル: Player.java プロジェクト: rredford/MultiplayerGame
 public void shoot(Vector2D Spot) {
   Action shooty = new Action(playerId, Action.SHOOT, Spot);
   tcp.sendSocket(prot.encodeAction(shooty));
 }
コード例 #4
0
ファイル: Player.java プロジェクト: rredford/MultiplayerGame
 public void join(String ip) {
   Action join = new Action(playerId, Action.JOIN_REQUEST, tcp.getMyIP());
   tcp.sendSocket(prot.encodeAction(join));
 }