Package edu.ups.gamedev.player

Examples of edu.ups.gamedev.player.Tank


   *
   * @param tankType
   * @return
   */
  protected Tank createTank(String tankType) {
    Tank tank = null;
    try {
      tank = new Tank(tankType);
    } catch (MalformedURLException murle) {
      ErrorHandler.log("Could not load resource " + tankType);
      ErrorHandler.exit();
    }

View Full Code Here


      switch(type) {
      case NetworkConstants.SPHERE:
        syncManager.register(object, new ColoredSynchronizeCreateMessage(((PlayerSphere) object).getColor()), rate);
        break;
      case NetworkConstants.TANK:
        Tank tank = (Tank) object;
        syncManager.register(object, new TankSynchronizeCreateMessage(tank), rate);
        break;
      case NetworkConstants.TEAPOT:
        Teapot teapot = (Teapot) object;
        syncManager.register(object, new TeapotSynchronizeCreateMessage(teapot), rate);
View Full Code Here

      TankGame.GAMESTATE.getRoot().updateRenderState();
      return p;
    } else if (scm instanceof TankSynchronizeCreateMessage) {
      System.out.println("TankSyncMsg");
      TankSynchronizeCreateMessage msg = (TankSynchronizeCreateMessage) scm;
      Tank tank = null;
      try {
        tank = new Tank(msg);
      } catch (MalformedURLException e) {
        System.err.println("Could not create Tank");
        e.printStackTrace();
        System.exit(1);
      }
     
      TankGame.GAME.lock();
      TankGame.GAMESTATE.getRoot().attachChild(tank);
      TankGame.GAMESTATE.getRoot().updateGeometricState(0, true);
      tank.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
      TankGame.GAMESTATE.getRoot().updateRenderState();
      TankGame.GAME.unlock();
      return tank;
    } else if (scm instanceof TeapotSynchronizeCreateMessage) {
      System.out.println("TeapotSyncMsg");
View Full Code Here

  public NetworkTanksState(boolean isServer, InetAddress serverAddress) {
    super(true);
   
    try {
      localTank = new Tank(Tank.MEDIUM_TANK);
    } catch (MalformedURLException e1) {
      e1.printStackTrace();
      System.exit(1);
    }
    rootNode.attachChild(localTank); //add our sphere to the scenegraph
View Full Code Here

   * @see SimpleGame
   */
  @Override
  protected void simpleInitGame() {
    try {
      localTank = new Tank(Tank.MEDIUM_TANK);
    } catch (MalformedURLException e1) {
      e1.printStackTrace();
      System.exit(1);
    }
    rootNode.attachChild(localTank); //add our sphere to the scenegraph
View Full Code Here

   * @see SimpleGame
   */
  @Override
  protected void simpleInitGame() {
    try {
      localTank = new Tank(Tank.LIGHT_TANK, color.clone()); //our player's light tank with the color chosen by the player
    } catch (MalformedURLException e) {
      System.err.println("Could not create Tank:");
      JOptionPane.showMessageDialog(null, "Could not create tank, exiting program...", "Fatal Error", JOptionPane.ERROR_MESSAGE);
      e.printStackTrace();
      System.exit(1);
View Full Code Here

   * @param obj  the actual <code>Object</code> that is going to be removed
   * @return    <code>true</code> if the <code>Object</code> was removed; <code>
   *         false</code> otherwise
   */
  public boolean remove(SynchronizeRemoveMessage srm, Object obj) {
    Tank tank = (Tank)obj;
    System.out.println("Removing player " + tank.getName());
    return tank.removeFromParent();
  }
View Full Code Here

   * @param color  the color of the <code>Tank</code> to be created
   * @return    the <code>Tank</code> that has been created to represent
   *         a remote player
   */
  private Tank buildRemoteTank(ColorRGBA color) {
    Tank tank;
    try {
      tank = new Tank("remoteTank", color); //create the tank
    } catch (MalformedURLException e) {
      System.err.println("Could not create tank for remote player:");
      e.printStackTrace();
      return null;
    }
    rootNode.attachChild(tank); //attach it to the scene graph
   
    //make sure the material gets applied correctly by forcing a few updates
    rootNode.updateGeometricState(0, true);
    tank.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
    rootNode.updateRenderState();
    return tank;
  }
View Full Code Here

   */
  protected void buildPlayer() {
    // TODO abstract player and tank creation

    // create player and tank
    Tank playerTank = createTank(Tank.LIGHT_TANK);
    player = new Player("Player", playerTank);

    // attach everything
    root.attachChild(playerTank);

    playerTank.setLocalTranslation(10, 200, 10);
    playerTank.setPrimaryWeapon(new Weapon(CannonFireable.class, new TeapotPlacingWarhead(), .2f));
    playerTank.setSecondaryWeapon(new Weapon(MissileFireable.class,  new KineticWarhead(), .2f));
    playerTank.addController(new TankController(playerTank));
   
    //register the player
    try {
      net.register(player.getControlledObject(), NetworkConstants.TANK);
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of edu.ups.gamedev.player.Tank

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.