Package game.entities

Examples of game.entities.Player


    if(cmd[0].equals(Command.ROOM_ENTERED)) {
      yourPlayer.setPlayerID(Integer.parseInt(data));
      ids.put(yourPlayer.getPlayerID(), yourPlayer);
     
    } else if(cmd[0].equals(Command.PLAYER_EXITED)) {
      Player toRemove = ids.remove(Integer.parseInt(data));
      System.out.println(toRemove.getPlayerID() + " HAS EXITED.");
      players.remove(toRemove);
    } else {
      if(yourPlayer.getPlayerID() != -1) {
        int whichPlayer = Integer.parseInt(cmd[1]);
        if(yourPlayer.getPlayerID() == whichPlayer) return;
        String[] info = data.split(",");
        if(cmd[0].equals(Command.NEWCOMER)) {
          registerPlayer(new Player(
              Integer.parseInt(info[0]), Integer.parseInt(info[1]),
              GameSettings.PLAYER_SIZE, GameSettings.PLAYER_SIZE,
              whichPlayer, Integer.parseInt(info[2]), Integer.parseInt(info[3]), Color.RED));
        } else if(cmd[0].equals(Command.INFO)) {
          Player pToMove = null;
          pToMove = ids.get(whichPlayer);
          pToMove.movRight = Boolean.parseBoolean(info[0]);
          pToMove.movLeft = Boolean.parseBoolean(info[1]);
          pToMove.movUp = Boolean.parseBoolean(info[2]);
          pToMove.movDown = Boolean.parseBoolean(info[3]);
          pToMove.movRightBlocked = Boolean.parseBoolean(info[4]);
          pToMove.movLeftBlocked = Boolean.parseBoolean(info[5]);
          pToMove.movUpBlocked = Boolean.parseBoolean(info[6]);
          pToMove.movDownBlocked = Boolean.parseBoolean(info[7]);
          /*pToMove.setLocation(Integer.parseInt(info[0]),
              Integer.parseInt(info[1]));*/
          pToMove.health = Integer.parseInt(info[8]);
        } else if(cmd[0].equals(Command.SYNC_INFO)) {
          Player pToMove = null;
          pToMove = ids.get(whichPlayer);
          pToMove.setLocation(Integer.parseInt(info[0]),
              Integer.parseInt(info[1]));
          //pToMove.health = Integer.parseInt(info[10]);
        } else if(cmd[0].equals(Command.EXISTING)) {
          registerPlayer(new Player(
              Integer.parseInt(info[0]),
              Integer.parseInt(info[1]),  GameSettings.PLAYER_SIZE,
              GameSettings.PLAYER_SIZE, whichPlayer,
              Integer.parseInt(info[2]), Integer.parseInt(info[3]),
              Color.RED));
        } else if(cmd[0].equals(Command.WEP_FIRE)) {
          Player firingPlayer = ids.get(whichPlayer);
          WeaponType firingWep =
            WeaponType.valueOf(info[0]);
 
          BulletCombo.spawnShot(firingWep,
              bullets, firingPlayer, new Point(
View Full Code Here


      });

      players = new ArrayList<Player>();
      bullets = new CopyOnWriteArrayList<Bullet>();
      ids = new HashMap<Integer, Player>();
      yourPlayer = new Player((int)(Math.random()*730)+40,
          (int)(Math.random()*530)+40, GameSettings.PLAYER_SIZE,
          GameSettings.PLAYER_SIZE, -1, 100, 3, Color.GREEN);
      yourPlayer.onGround = true
      frame.setTitle("Game Client: " + yourPlayer.getPlayerID() +
          " in room " + roomName + " playing on " + mapName);
View Full Code Here

TOP

Related Classes of game.entities.Player

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.