示例#1
0
 @Override
 public void update(float delta) {
   super.update(delta);
   if (body != null) {
     body.setLinearVelocity(stage.getPlatformsSpeed(), 0);
     if (body.getPosition().x < -10) {
       stage = null;
       this.markOnDelete();
     }
     if (disable) {
       x = body.getPosition().x;
       y = body.getPosition().y;
       WorldUtils.world.destroyBody(body);
       body = createBody(x, y, WorldUtils.toBox2d(width), WorldUtils.toBox2d(height), true);
       body.setLinearVelocity(stage.getPlatformsSpeed(), 0);
       disable = false;
     }
     if (shouldDie && deathTimer > 0) {
       blinktime -= delta;
       deathTimer -= delta;
       if (blinktime < -0.1f) {
         blinktime = 0.1f;
       }
     } else if (shouldDie && deathTimer < 0) {
       markOnDelete();
       shouldDie = false;
     }
   }
 }