Beispiel #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;
     }
   }
 }
Beispiel #2
0
 @Override
 public void onStartContact(PhysicsThing otherBody, int thisType, int otherType) {
   super.onStartContact(otherBody, thisType, otherType);
   if (thisType == Constants.POTION_FIXTURE) {
     if (otherType == Constants.DAMAGE_AREA_FIXTURE) {
       stage.setPotionEaten();
       markOnDelete();
     } else if (otherType == Constants.FIELD_FIXTURE) {
       SkillField damager = (SkillField) otherBody;
       damager.creator.setSkillOk();
       disable = true;
       if (damager.specialType == Constants.SPECIAL_OLD) {
         shouldDie = true;
         deathTimer = 1;
         blinktime = 0.1f;
       }
     }
   }
 }
Beispiel #3
0
 @Override
 public void onEndContact(PhysicsThing otherBody, int thisType, int otherType) {
   super.onEndContact(otherBody, thisType, otherType);
 }