示例#1
0
文件: Player.java 项目: kotucz/ld26
  public void jump() {
    Vec2 linearVelocity = getBody().getLinearVelocity();
    linearVelocity.y = JUMP_SPEED;
    getBody().setLinearVelocity(linearVelocity);

    SOUND_JUMP.play();
  }
示例#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();
   }
 }
示例#3
0
文件: Player.java 项目: kotucz/ld26
 @Override
 public void update(float delta) {
   super.update(delta);
   if (getBody().getPosition().y > 16) {
     PlayN.log().debug("Fallen!");
     SOUND_OUCH.play();
     dead = true;
   }
 }
示例#4
0
文件: Player.java 项目: kotucz/ld26
 @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;
     }
   }
 }