Exemplo n.º 1
0
 private static void createChainLights(TiledMap map, PooledEngine engine) {
   for (Layer layer : map.getLayers()) {
     if (layer.isObjectLayer()) {
       for (LayerObject obj : layer.getObjects()) {
         String entitytype = obj.getProperty("Entitytype", null);
         if (entitytype != null && entitytype.toLowerCase().equals("chainlight")) {
           createChainLight(
               engine,
               obj.getX(),
               obj.getY(),
               Color.valueOf(obj.getProperty("color", "FFFFFF")),
               obj.getFloatProperty("distance", 200),
               obj.getIntProperty("direction", 1),
               obj.getPoints());
         }
       }
     }
   }
 }
Exemplo n.º 2
0
 private static void createMapEntity(
     String entitytype,
     PooledEngine engine,
     PhysixSystem physixSystem,
     LayerObject obj,
     Team team) {
   switch (entitytype) {
     case "goal":
       createTrigger(
           engine,
           physixSystem,
           obj.getX(),
           obj.getY(),
           obj.getWidth(),
           obj.getHeight(),
           new GoalTrigger(engine, team));
       break;
     case "magnet":
       if (team == Team.BLUE) {
         entitytype = "magnet_minus";
       } else {
         entitytype = "magnet_plus";
       }
     case "playerspawn":
     case "ballspawn":
       createEntity(
           engine,
           entitytype,
           obj.getX() + obj.getWidth() / 2.0f,
           obj.getY() - obj.getHeight() / 2.0f,
           team);
       break;
     case "goal_particles_tl":
       // System.out.println("found dings");
       createEntity(
           engine,
           entitytype,
           obj.getX() + obj.getWidth() / 2.0f,
           obj.getY() - obj.getHeight() / 2.0f,
           team);
       break;
     case "goal_particles_tr":
       createEntity(
           engine,
           entitytype,
           obj.getX() + obj.getWidth() / 2.0f,
           obj.getY() - obj.getHeight() / 2.0f,
           team);
       break;
     case "goal_particles_bl":
       createEntity(
           engine,
           entitytype,
           obj.getX() + obj.getWidth() / 2.0f,
           obj.getY() - obj.getHeight() / 2.0f,
           team);
       break;
     case "goal_particles_br":
       createEntity(
           engine,
           entitytype,
           obj.getX() + obj.getWidth() / 2.0f,
           obj.getY() - obj.getHeight() / 2.0f,
           team);
       break;
     default:
       System.out.println(entitytype + "Nicht bekannt");
   }
 }