world.setPosition(new Vector2f(97.5f, -40.0f));
world.addDrop();
world.setPosition(new Vector2f(97.6f, -41.0f));
world.addDrop();
final Body figure = world.addFigure(0, 0);
// Nachdem die Einstellungen für die physikalische Welt erledigt sind,
// kommen nun Einstellungen für das Level
this.simulatedWorld = new SimulatedWorld(this);
// Wasserfalleffekt einfügen
this.simulatedWorld.add(new ParticleEffect(new Vector2f(97.5f, -1.0f), new FogEmitterFactory()));
this.simulatedWorld.add(new ParticleEffect(new Vector2f(97.5f, -40.0f), new WaterfallEmitterFactory(36.0f)));
// Unteres Wasser hinzufügen
this.simulatedWorld.add(new DrawablePollable() {
private float y = 0.0f;
private float timeout = 0.0f;
public void draw(Graphics g) {
Color oldColor = g.getColor();
g.setColor(new Color(0.0f, 0.0f, 1.0f, 0.4f));
g.fillRect(-50.0f, 20.2f + this.y, 200.0f, 3.0f);
g.setColor(oldColor);
}
public void poll(Input input, float secounds) {
this.timeout -= secounds;
if(this.timeout <= 0) {
this.timeout = 0.2f;
this.y = (float) ((Math.random() - 0.5) * 0.1);
}
}
});
// Hintergrund hinzufügen
this.simulatedWorld.addBackground(new Drawable() {
public void draw(Graphics g) {
g.pushTransform();
DemoLevel.this.simulatedWorld.doCameraTranslation(g);
g.texture(new Rectangle(-50.0f, -40.0f, 200.0f, 60.0f), ResourceManager.getInstance().getImage("landscape.png"), true);
g.popTransform();
}
});
// Spielfigur
// final Body figure = world.addFigure(117.0f, -30.0f);
// Kamera Einstellung
this.simulatedWorld.setCamera(new Camera() {
public ROVector2f getPosition() {
return figure.getPosition();
}
public void poll(Input input, float secounds) { }
});
}