Package org.pokenet.client.backend.entity

Examples of org.pokenet.client.backend.entity.HMObject


         * Parse all the information. This packet contains details for all players on this map
         */
        for(int i = 0; i < details.length - 1; i++) {
          p = new Player();
          try {
            HMObject hm = new HMObject(HMObject.parseHMObject(details[i]));
            i++;
            hm.setId(Integer.parseInt(details[i]));
            i ++;
            hm.setSprite(Integer.parseInt(details[i]));
            i ++;
            hm.setX(Integer.parseInt(details[i]));
            hm.setServerX(Integer.parseInt(details[i]));
            i++;
            hm.setY(Integer.parseInt(details[i]));
            hm.setServerY(Integer.parseInt(details[i]));
            i++;
            hm.setDirection(Direction.Down);
            hm.loadSpriteImage();
            p = hm;
          } catch (Exception e) {
            p.setUsername(details[i]);
            i++;
            p.setId(Integer.parseInt(details[i]));
            i++;
            p.setSprite(Integer.parseInt(details[i]));
            i++;
            p.setX(Integer.parseInt(details[i]));
            p.setServerX(Integer.parseInt(details[i]));
            i++;
            p.setY(Integer.parseInt(details[i]));
            p.setServerY(Integer.parseInt(details[i]));
            i++;
            switch(details[i].charAt(0)) {
            case 'D':
              p.setDirection(Direction.Down);
              break;
            case 'L':
              p.setDirection(Direction.Left);
              break;
            case 'R':
              p.setDirection(Direction.Right);
              break;
            case 'U':
              p.setDirection(Direction.Up);
              break;
            default:
              p.setDirection(Direction.Down);
              break;
            }
            p.loadSpriteImage();
          }
          if(p.getId() == m_game.getPlayerId()) {
            /*
             * This dude is our player! Store this information
             */
            p.setOurPlayer(true);
            OurPlayer pl;
            if(m_game.getOurPlayer() == null) {
              pl = new OurPlayer();
            } else {
              pl = new OurPlayer(m_game.getOurPlayer());
            }
            pl.set(p);
            m_game.setOurPlayer(pl);
            m_game.getMapMatrix().addPlayer(pl);
            GameClient.getInstance().setOurPlayer(pl);
            GameClient.getInstance().getOurPlayer().setAnimating(true);
          } else{
            m_game.getMapMatrix().addPlayer(p);
          }
        }
        break;
      case 'a':
        //Add player
        details = message.substring(2).split(",");
        p = new Player();
        try {
          HMObject hm = new HMObject(HMObject.parseHMObject(details[0]));
          hm.setId(Integer.parseInt(details[1]));
          hm.setSprite(Integer.parseInt(details[2]));
          hm.setX(Integer.parseInt(details[3]));
          hm.setServerX(Integer.parseInt(details[3]));
          hm.setY(Integer.parseInt(details[4]));
          hm.setServerY(Integer.parseInt(details[4]));
          hm.setDirection(Direction.Down);
          hm.loadSpriteImage();
          p = hm;
          p.setId(hm.getId());
        } catch (Exception e) {
          p.setUsername(details[0]);
          p.setId(Integer.parseInt(details[1]));
          p.setSprite(Integer.parseInt(details[2]));
          p.setX(Integer.parseInt(details[3]));
View Full Code Here

TOP

Related Classes of org.pokenet.client.backend.entity.HMObject

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.