Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Vector2.dst()


      System.out.println("synchronize");
      for(NetworkShip ship:enemies) {
        if(ship.id.equalsIgnoreCase(id)) {
          System.out.println("synchronize " + ship.id)
          Vector2 networkPos = new Vector2(Float.parseFloat(positionx),Float.parseFloat(positiony));
          if(networkPos.dst(ship.body.getPosition())>1) {                           
            gameSession.networkUpdates.add(new UpdatePackage(ship, networkPos, Float.parseFloat(angle)));
          } else {
              networkPos.sub(ship.body.getPosition());
              Vector2 newPos = ship.body.getPosition().tmp().add(networkPos.mul(0.1f));
              gameSession.networkUpdates.add(new UpdatePackage(ship, newPos, Float.parseFloat(angle)));
View Full Code Here


                      System.out.println("synchronize");
                      for(NetworkShip ship:enemies) {
                        if(ship.id.equalsIgnoreCase(obj.getString("player"))) {
                          System.out.println("synchronize " + ship.id)
                          Vector2 networkPos = new Vector2((float) obj.getJSONObject("message").getDouble("positionx"),(float) obj.getJSONObject("message").getDouble("positiony"));
                          if(networkPos.dst(ship.body.getPosition())>1) {                           
                            gameSession.networkUpdates.add(new UpdatePackage(ship, networkPos, (float)obj.getJSONObject("message").getDouble("angle")));
                          } else {
                            networkPos.sub(ship.body.getPosition());
                            Vector2 newPos = ship.body.getPosition().tmp().add(networkPos.mul(0.1f));
                            gameSession.networkUpdates.add(new UpdatePackage(ship, newPos, (float)obj.getJSONObject("message").getDouble("angle")));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.