Package edu.ups.gamedev.player

Examples of edu.ups.gamedev.player.PlayerSphere


   */
  public Object create(SynchronizeCreateMessage scm) {
    if (scm instanceof ColoredSynchronizeCreateMessage) {
      System.out.println("ColorSyncMsg");
      ColoredSynchronizeCreateMessage msg = (ColoredSynchronizeCreateMessage) scm;
      PlayerSphere p = new PlayerSphere("remote", msg.getColor());
      TankGame.GAMESTATE.getRoot().attachChild(p);
      TankGame.GAMESTATE.getRoot().updateGeometricState(0, true);
      p.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
      TankGame.GAMESTATE.getRoot().updateRenderState();
      return p;
    } else if (scm instanceof TankSynchronizeCreateMessage) {
      System.out.println("TankSyncMsg");
      TankSynchronizeCreateMessage msg = (TankSynchronizeCreateMessage) scm;
View Full Code Here


   *
   * @see SimpleGame
   */
  @Override
  protected void simpleInitGame() {
    localSphere = new PlayerSphere("localSphere", color.clone()); //the sphere for our player, we'll make it red
    rootNode.attachChild(localSphere); //add our sphere to the scenegraph
   
    //setup additional keyboard commands
    //note that SimpleGame (which our class extends) already gives us WASD movement and mouse-look controls
    //so we'll use UHJK to move the client sphere, like WASD, but on the other side of the keyboard
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) {
    PlayerSphere s = (PlayerSphere)obj;
    System.out.println("Removing player " + s.getName());
    return s.removeFromParent();
  }
View Full Code Here

   * @param color  the color of the <code>PlayerSphere</code> to be created
   * @return    the <code>PlayerSphere</code> that has been created to represent
   *         a remote player
   */
  private PlayerSphere buildRemotePlayer(ColorRGBA color) {
    PlayerSphere s = new PlayerSphere("remoteSphere", color); //create the sphere
    rootNode.attachChild(s); //attach it to the scene graph
   
    //make sure the material gets applied correctly by forcing a few updates
    rootNode.updateGeometricState(0, true);
    s.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
    rootNode.updateRenderState();
    return s;
  }
View Full Code Here

    JGN.createThread(syncManager).start();
   
    //get localSphere from the game
    Field field = ExampleGame.class.getDeclaredField("localSphere");
    field.setAccessible(true);
    PlayerSphere player = null;
    while((player = (PlayerSphere)field.get(app)) == null) {
      try {
        Thread.sleep(100);
      }catch(Exception e) {
        System.err.println("Error while thread sleeping to get field:");
View Full Code Here

  }
 
  @Override
  protected void simpleInitGame() {
    scene = rootNode; //copy rootNode into scene so that we can use reflection to get it later
    localSphere = new PlayerSphere("localSphere", ColorRGBA.red.clone()); //the sphere for our player, we'll make it red
    rootNode.attachChild(localSphere); //add our sphere to the scenegraph
   
    //setup additional keyboard commands
    //note that SimpleGame (which our class extends) already gives us WASD movement and mouse-look controls
    //so we'll use UHJK to move the client sphere, like WASD, but on the other side of the keyboard
View Full Code Here

    JGN.createThread(syncManager).start(); //create and start a thread for the synchronization manager
   
    //get localSphere from the game
    Field field = ExampleGame.class.getDeclaredField("localSphere");
    field.setAccessible(true);
    PlayerSphere player = null;
    while((player = (PlayerSphere)field.get(app)) == null) {
      try {
        Thread.sleep(100);
      }catch(Exception e) {
        System.err.println("Error while thread sleeping to get field:");
View Full Code Here

    return buildRemotePlayer();
  }

  //called when a remote host requests an object be removed
  public boolean remove(SynchronizeRemoveMessage srm, Object obj) {
    PlayerSphere s = (PlayerSphere)obj;
    System.out.println("Removing player " + s.getName());
    return s.removeFromParent();
  }
View Full Code Here

    return s.removeFromParent();
  }
 
  //generator function to create new PlayerSpheres for remote players
  private PlayerSphere buildRemotePlayer() {
    PlayerSphere s = new PlayerSphere("remoteSphere", ColorRGBA.green.clone());
    scene.attachChild(s);
    scene.updateGeometricState(0, true);
    s.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
    scene.updateRenderState();
    return s;
  }
View Full Code Here

TOP

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

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.