mirror of
https://inf.pirckheimer-gymnasium.de/kebab/kebab
synced 2026-08-26 16:31:23 +00:00
Implement carousel-like reappearence of the one and only customer, Mr. Eggman
This commit is contained in:
@@ -7,27 +7,32 @@ import pi.Text;
|
||||
import pi.actor.Actor;
|
||||
import pi.actor.Animation;
|
||||
import pi.actor.Image;
|
||||
import pi.event.FrameListener;
|
||||
import pi.graphics.geom.Vector;
|
||||
|
||||
import static pi.Controller.fonts;
|
||||
import java.awt.Font;
|
||||
|
||||
|
||||
public class GameScene extends Scene
|
||||
public class GameScene extends Scene implements FrameListener
|
||||
{
|
||||
Rectangle bg;
|
||||
Text[] texts;
|
||||
Actor[] customers;
|
||||
|
||||
public GameScene() {
|
||||
// the background music, color, stats (some meta information)
|
||||
Controller.jukebox.playSound("sounds/Mozart_Turkish_March_-_Orchestral_Melodic_Techno_-_TVV_music_320k.mp3");
|
||||
Rectangle bg = new Rectangle(2000, 2000);
|
||||
bg = new Rectangle(2000, 2000);
|
||||
bg.color("#ffffff");
|
||||
bg.center(0,0);
|
||||
bg.center(0, 0);
|
||||
bg.layerPosition(-100);
|
||||
addStatsCollectionOutline(this);
|
||||
Text[] texts = createTexts(this);
|
||||
texts = createTexts(this);
|
||||
camera().meter(10);
|
||||
|
||||
// create customers
|
||||
Actor[] customers = new Actor[1];
|
||||
customers = new Actor[1];
|
||||
customers[0] = Animation.createFromAnimatedGif("images/kebab-pack/customer-mr-eggman.gif", 1.48*25, 1.25*25);
|
||||
customers[0].center(-60,0);
|
||||
customers[0].applyImpulse(new Vector(1, 0).multiply(100000));
|
||||
@@ -37,6 +42,13 @@ public class GameScene extends Scene
|
||||
add(customers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFrame(double pastTime)
|
||||
{
|
||||
if(visibleArea().xRight() < customers[0].anchor().add(new Vector(-20, 0)).x()) {
|
||||
customers[0].center(-60,0);
|
||||
}
|
||||
}
|
||||
|
||||
// Static helper methods
|
||||
public static void addStatsCollectionOutline(Scene scene) {
|
||||
|
||||
Reference in New Issue
Block a user