public void jump() { Vec2 linearVelocity = getBody().getLinearVelocity(); linearVelocity.y = JUMP_SPEED; getBody().setLinearVelocity(linearVelocity); SOUND_JUMP.play(); }
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(); } }
@Override public void update(float delta) { super.update(delta); if (getBody().getPosition().y > 16) { PlayN.log().debug("Fallen!"); SOUND_OUCH.play(); dead = true; } }
@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; } } }