Ejemplo n.º 1
0
  public void jump() {
    Vec2 linearVelocity = getBody().getLinearVelocity();
    linearVelocity.y = JUMP_SPEED;
    getBody().setLinearVelocity(linearVelocity);

    SOUND_JUMP.play();
  }
Ejemplo n.º 2
0
 private void complete() {
   complete = true;
   final Surface surface = surfaceLayer.surface();
   surface.clear();
   surface.drawImage(image, 20, 20, surface.width(), surface.height());
   if (sound != null) {
     sound.play();
   }
 }
Ejemplo n.º 3
0
 @Override
 public void update(float delta) {
   super.update(delta);
   if (getBody().getPosition().y > 16) {
     PlayN.log().debug("Fallen!");
     SOUND_OUCH.play();
     dead = true;
   }
 }
Ejemplo n.º 4
0
 @Override
 public void contact(PhysicsEntity other) {
   if (other instanceof Spike) {
     PlayN.log().debug("Ouch!");
     SOUND_OUCH.play();
     dead = true;
   } else if (other instanceof Block) {
     Block block = (Block) other;
     if (!block.isCollidable()) {
       exitReached = true;
     }
   }
 }