コード例 #1
0
 @Override
 public void update(WorldEvent e) {
   if (e.getType() == WorldEvent.Type.WORLD_UPDATE) {
     World w = e.getSource();
     synchronized (this.entities) {
       this.entities.clear();
       for (Entity<?> entity : w.getEntities()) {
         this.entities.add((Entity<?>) entity.clone());
         if (entity instanceof MarioBody) {
           this.cameraPos =
               new Point2D(
                   (int) (entity.getLocation().getX() * Game.SCALE - Game.SCENE_WIDTH / 2 + 0.5),
                   0);
         }
       }
     }
   }
 }