Example usage for com.badlogic.gdx.input GestureDetector GestureDetector

List of usage examples for com.badlogic.gdx.input GestureDetector GestureDetector

Introduction

In this page you can find the example usage for com.badlogic.gdx.input GestureDetector GestureDetector.

Prototype

public GestureDetector(float halfTapSquareSize, float tapCountInterval, float longPressDuration,
        float maxFlingDelay, GestureListener listener) 

Source Link

Usage

From source file:com.badlogicgames.superjumper.CharScreen.java

License:Apache License

public CharScreen(Game game) {
    this.game = game;
    this.ruota = new Spring(-160, -50);
    this.bob = new Bob(centrox, centroy);
    this.bobfem = new Bob(iniziox - 100, inizioy);
    this.bobmil = new Bob(iniziox - 150, inizioy);
    this.buttons = new ArrayList<Button>();
    guiCam = new OrthographicCamera(320, 480);
    guiCam.position.set(320 / 2, 480 / 2, 0);
    nextBounds = new Rectangle(320 - 64, 0, 64, 64);
    backBounds = new Rectangle(0, 0, 64, 64);
    character = new Rectangle(120, 150, 120, 150);
    touchPoint = new Vector3();
    batcher = new SpriteBatch();
    this.bob.CHARSCREENUSE = 1;
    this.bobfem.CHARSCREENUSE = 1;
    this.bobmil.CHARSCREENUSE = 1;

    gestureDetector = new GestureDetector(20, 0.5f, 2, 0.15f, new GestureListener() {

        @Override/*from ww w  .  j  ava2  s  .  c  o m*/
        public boolean zoom(float initialDistance, float distance) {
            // TODO Auto-generated method stub
            return false;
        }

        @Override
        public boolean touchDown(float x, float y, int pointer, int button) {
            // TODO Auto-generated method stub
            return false;
        }

        @Override
        public boolean tap(float x, float y, int count, int button) {
            //guiCam.zoom=0.2f;
            return false;
        }

        @Override
        public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1,
                Vector2 pointer2) {
            // TODO Auto-generated method stub
            return false;
        }

        @Override
        public boolean pan(float x, float y, float deltaX, float deltaY) {
            // TODO Auto-generated method stub
            return false;
        }

        @Override
        public boolean longPress(float x, float y) {
            //guiCam.zoom=1f;
            return false;
        }

        @Override
        public boolean fling(float velocityX, float velocityY, int button) {
            // TODO Auto-generated method stub
            //Gdx.app.debug("x"+velocityX, "y"+velocityY);
            if (Math.abs(velocityX) > Math.abs(velocityY)) {
                if (velocityX > 0) {//Gdx.app.debug("UPDATEGRAVITY", "x="+bob.position.x);
                    if (bob.position.x > centrox - 20 && bob.position.x < centrox + 20) {
                        swipedeactive = 1;
                        swipestate = 1;
                    }
                    if (bob.position.x <= iniziox) {
                        swipestate = 2;
                    }
                    if (bob.position.x >= finex) {
                        swipestate = 5;
                    }
                } else if (velocityX < 0) {
                    //Gdx.app.debug("UPDATEGRAVITY", "x="+bob.position.x);

                    if (bob.position.x >= finex) {
                        swipestate = 4;
                    }
                    if (bobfem.position.x >= finex) {
                        swipestate = 6;
                    }
                }

                else {
                    // Do nothing.
                }
            } else {

                // Ignore the input, because we don't care about up/down swipes.
            }
            return true;

        }
    });
    Gdx.input.setInputProcessor(gestureDetector);

}

From source file:com.formatic.boxes.Boxes.java

License:Open Source License

private void setGestureDetector() {
    gestureDetector = new GestureDetector(1, 0.1f, 1.1f, 10000, screenController);
    Gdx.input.setInputProcessor(gestureDetector);

}

From source file:com.jmolina.orb.screens.Level.java

License:Open Source License

/**
 * Constructor//  ww  w  .j  a  v a 2s  . c o m
 *
 * @param sm SuperManager
 */
public Level(SuperManager sm) {
    super(sm);

    achievedRobocop = false;
    achievedItsOver9000 = false;
    achievedHyperdrive = false;

    tick = new Tick();
    pixelsPerMeter = getGameManager().getPixelsPerMeter();
    impulse = IMPULSE_FACTOR / getPixelsPerMeter();
    lastOrbPosition = new Vector2();
    stats = new GameStats();

    float worldWidth = VIEWPORT_WIDTH / getPixelsPerMeter();
    float worldHeight = VIEWPORT_HEIGHT / getPixelsPerMeter();
    worldViewport = new FitViewport(worldWidth, worldHeight);
    gestureViewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
    parallaxViewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
    hudViewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);

    hudStage = new HUDStage(this, getAssetManager(), hudViewport);
    gestureStage = new GestureStage(getAssetManager(), gestureViewport, getPixelsPerMeter());
    parallaxStage = new ParallaxStage(getAssetManager(), parallaxViewport, getPixelsPerMeter());

    worldManager = new WorldManager();
    setOrb(new Orb(getAssetManager(), worldManager.getWorld(), getPixelsPerMeter()));
    worldManager.bindContactHandler(this, getOrb());

    GestureDetector gestureDetector = new GestureDetector(GESTURE_HALF_TAP_SQUARE_SIZE,
            GESTURE_TAP_COUNT_INTERVAL, GESTURE_LONG_PRESS_DURATION, GESTURE_MAX_FLING_DELAY,
            new GestureHandler(this));

    situationManager = new SituationManager(getAssetManager(), worldManager.getWorld(), getOrb(),
            getPixelsPerMeter(), getMainStage(), worldViewport);

    addProcessor(hudStage);
    addProcessor(gestureStage);
    addProcessor(gestureDetector);
    createRunnables();
    disableTicking();
    lock();
}

From source file:com.qualcomm.vuforia.samples.libGDX.screens.ChooseBallScreen.java

License:Apache License

@Override
public void create() {
    if (app.createServerScreen.create != null) {
        app.createServerScreen.create.resetUserChoiceState();
        app.createServerScreen.create.startBallsDistribute();
    } else if (app.joinServerScreen.join != null) {
        PropertiesSingleton.getInstance()
                .initRandomCoinPosition(PropertiesSingleton.getInstance().getChosenIsland());
        //PropertiesSingleton.getInstance().initRandomPowerupPosition(PropertiesSingleton.getInstance().getChosenIsland());
    }// www  . j a  v a 2  s .  c o  m

    modelBatch = new ModelBatch();

    fps = new FPSLogger();
    Gdx.app.log("height: " + Gdx.graphics.getHeight() + "", "width: " + Gdx.graphics.getWidth() + "");

    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
    environment.add((shadowLight = new DirectionalShadowLight(1024, 1024, 30f, 30f, 1f, 100f)).set(0.8f, 0.8f,
            0.8f, -1f, -.8f, -.2f));
    environment.shadowMap = shadowLight;

    shadowBatch = new ModelBatch(new DepthShaderProvider());

    cam = new VuforiaCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.near = 0.1f;
    cam.far = 300f;
    cam.update();

    instances = new Array<ModelInstance>();
    //       instances.add(new ModelInstance(model, "floor"));
    //        instances.add(ball = new Ball(model, "ball"));
    //        ball.setPosition(1f, 1f, 1f);

    this.stage = new Stage(new StretchViewport(Gdx.graphics.getHeight(), Gdx.graphics.getHeight()));

    initFonts();
    //        BitmapFont font = new BitmapFont();
    Label.LabelStyle labelStyle = new Label.LabelStyle(app.font60, Color.WHITE);
    Label.LabelStyle labelStyle2 = new Label.LabelStyle(app.font60, Color.WHITE);
    Label labelTitle = new Label("CHOOSE BALL ", labelStyle);
    LabelScore = new Label("apple", labelStyle2);
    //        labelTitle.setScale(Gdx.graphics.getWidth() / 10, Gdx.graphics.getHeight() / 10);
    Gdx.app.log("width: " + Gdx.graphics.getWidth(), "height: " + Gdx.graphics.getHeight());
    labelTitle.setPosition(Gdx.graphics.getHeight() / 2 - labelTitle.getWidth() / 2,
            Gdx.graphics.getHeight() - labelTitle.getHeight() * 2);

    LabelScore.setPosition(Gdx.graphics.getHeight() - (LabelScore.getWidth() + Gdx.graphics.getHeight() / 50),
            LabelScore.getHeight() / 2);

    swipe = new Image(new Sprite(new Texture(Gdx.files.internal("swipe2.png"))));
    swipe.addAction(Actions.sequence(Actions.fadeOut(0.00000001f), Actions.delay(2), Actions.fadeIn(1)));
    //        swipe.setSize((stage.getWidth()) / 6, stage.getHeight() / 6);
    swipe.setPosition(Gdx.graphics.getHeight() / 2 - swipe.getWidth() / 2,
            Gdx.graphics.getHeight() / 2 - swipe.getHeight() / 2);
    stage.addActor(swipe);

    accept = new Image(new Sprite(new Texture(Gdx.files.internal("accept.png"))));
    //        accept.addAction(Actions.sequence(Actions.fadeOut(0.00000001f), Actions.delay(2), Actions.fadeIn(1)));
    accept.setSize((stage.getWidth()) / 10, stage.getWidth() / 10);
    accept.setPosition(Gdx.graphics.getHeight() / 2 - accept.getWidth() / 2, accept.getHeight());
    //        stage.addActor(accept);

    stage.addActor(LabelScore);
    stage.addActor(labelTitle);

    TextureAtlas atlasVote = new TextureAtlas("Buttons.pack");

    Skin voteSkin = new Skin(atlasVote);

    ImageButton.ImageButtonStyle voteButtonStyle = new ImageButton.ImageButtonStyle(); //Instaciate
    voteButtonStyle.up = voteSkin.getDrawable("ready"); //Set image for not pressed button
    voteButtonStyle.checked = voteSkin.getDrawable("notready"); //Set image for not pressed button

    readyButton = new ImageButton(voteButtonStyle);

    readyButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (app.joinServerScreen.join != null) {
                app.joinServerScreen.join.sendBallChoice(ballNames.get(currentBall));
            } else if (app.createServerScreen.create != null) {
                app.createServerScreen.create.serverUser.setBallChoice(ballNames.get(currentBall));
                app.createServerScreen.create.serverUser.setChosen(true);
                app.createServerScreen.create.notifyBalls();
            }
        }
    });

    readyButton.setSize((stage.getWidth()) / 5, stage.getWidth() / 10);

    readyButton.setPosition(Gdx.graphics.getHeight() / 2 - readyButton.getWidth() / 2, 0);
    stage.addActor(readyButton);

    for (int i = 0; i < ballNames.size; i++) {
        Model tmpModel = assets.get("3d/balls/" + ballNames.get(i) + ".g3db", Model.class);

        for (int k = 0; k < tmpModel.meshes.size; k++)
            tmpModel.meshes.get(k).scale(5, 5, 5);
        //            String id = tmpModel.nodes.get(0).id;
        //            Node node = tmpModel.getNode(id);
        //            node.scale.set(30f, 30f, 30f);
        //            node.translation.set(0, 15f, 0);
        //            tmpModel.calculateTransforms();
        instances.add(new ModelInstance(tmpModel));
    }

    InputMultiplexer inputMultiplexer = new InputMultiplexer();
    inputMultiplexer.addProcessor(stage);
    inputMultiplexer.addProcessor(new GestureDetector(0.0f, 0.0f, 0.0f, 5f, this));
    Gdx.input.setInputProcessor(inputMultiplexer);
}

From source file:com.qualcomm.vuforia.samples.libGDX.screens.ChooseIslandScreen.java

License:Apache License

@Override
public void create() {
    if (app.createServerScreen.create != null) {
        app.createServerScreen.create.resetUserChoiceState();
        app.createServerScreen.create.startIslandVote();
    }/*from   w w  w  .  j a va 2 s  .  co m*/

    modelBatch = new ModelBatch();

    fps = new FPSLogger();
    Gdx.app.log("height: " + Gdx.graphics.getHeight() + "", "width: " + Gdx.graphics.getWidth() + "");

    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
    //        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
    //        environment.add((shadowLight = new DirectionalShadowLight(1024, 1024, 30f, 30f, 1f, 100f)).set(0.8f, 0.8f, 0.8f, -1f, -.8f,
    //                -.2f));
    //        environment.shadowMap = shadowLight;

    shadowBatch = new ModelBatch(new DepthShaderProvider());

    cam = new VuforiaCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    cam.near = 0.1f;
    cam.far = 300f;
    cam.update();

    instances = new Array<ModelInstance>();
    voteButtons = new Array<ImageButton>();

    this.stage = new Stage(new StretchViewport(Gdx.graphics.getHeight(), Gdx.graphics.getHeight()));

    initFonts();
    //        BitmapFont font = new BitmapFont();
    Label.LabelStyle labelStyle = new Label.LabelStyle(app.font60, Color.WHITE);
    Label.LabelStyle labelStyle2 = new Label.LabelStyle(app.font60, Color.WHITE);
    Label labelTitle = new Label("CHOOSE ISLAND ", labelStyle);
    LabelScore = new Label("forest", labelStyle2);
    //        labelTitle.setScale(Gdx.graphics.getWidth() / 10, Gdx.graphics.getHeight() / 10);
    Gdx.app.log("width: " + Gdx.graphics.getWidth(), "height: " + Gdx.graphics.getHeight());
    labelTitle.setPosition(Gdx.graphics.getHeight() / 2 - labelTitle.getWidth() / 2,
            Gdx.graphics.getHeight() - labelTitle.getHeight() * 2);

    LabelScore.setPosition(Gdx.graphics.getHeight() - (LabelScore.getWidth() + Gdx.graphics.getHeight() / 50),
            LabelScore.getHeight() / 2);

    swipe = new Image(new Sprite(new Texture(Gdx.files.internal("swipe2.png"))));
    swipe.addAction(Actions.sequence(Actions.fadeOut(0.00000001f), Actions.delay(2), Actions.fadeIn(1)));
    //        swipe.setSize((stage.getWidth()) / 6, stage.getHeight() / 6);
    swipe.setPosition(Gdx.graphics.getHeight() / 2 - swipe.getWidth() / 2,
            Gdx.graphics.getHeight() / 2 - swipe.getHeight() / 2);
    stage.addActor(swipe);

    accept = new Image(new Sprite(new Texture(Gdx.files.internal("accept.png"))));
    accept.setSize((stage.getWidth()) / 10, stage.getWidth() / 10);
    accept.setPosition(Gdx.graphics.getHeight() / 2 - accept.getWidth() / 2, accept.getHeight());

    stage.addActor(LabelScore);
    stage.addActor(labelTitle);

    TextureAtlas atlasVote = new TextureAtlas("Buttons.pack");

    Skin voteSkin = new Skin(atlasVote);

    ImageButton.ImageButtonStyle voteButtonStyle = new ImageButton.ImageButtonStyle(); //Instaciate
    voteButtonStyle.up = voteSkin.getDrawable("notvoted"); //Set image for not pressed button
    voteButtonStyle.checked = voteSkin.getDrawable("voted"); //Set image for pressed

    for (int i = 0; i < islandNames.size; i++) {
        Model tmpModel = assets.get("3d/islands/" + islandNames.get(i) + ".g3db", Model.class);
        //            tmpModel.meshes.get(0).scale(3,3,3);
        //            Texture texture2 = new Texture(Gdx.files.internal("3d/islands/"+islandNames.get(i)+".jpg"), Pixmap.Format.RGB888, false);
        //            TextureAttribute textureAttribute = new TextureAttribute(TextureAttribute.Diffuse, texture2);
        //            Material material = tmpModel.materials.get(0);
        //            material.set(textureAttribute);
        instances.add(new ModelInstance(tmpModel));
    }

    int numberOfIslands = islandNames.size;
    for (int i = 0; i < numberOfIslands; i++) {
        ImageButton item1Button = new ImageButton(voteButtonStyle);
        item1Button.setSize((stage.getWidth()) / 10, stage.getWidth() / 6);

        //        Gdx.input.setInputProcessor(stage);

        item1Button.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                voted = islandNames.get(currentIsland);
                if (app.joinServerScreen.join != null) {
                    app.joinServerScreen.join.sendIslandChoice(voted);
                } else if (app.createServerScreen != null) {
                    app.createServerScreen.create.serverUser.setIslandChoice(voted);
                    app.createServerScreen.create.serverUser.setChosen(true);
                    app.createServerScreen.create.notifyIsland();
                }
                //boolean found = false;
                /*for(int k = 0; k < voted.size; k++)
                {
                if(voted.get(k) == islandNames.get(currentIsland))
                    found = true;
                }
                        
                if(!found)
                voted.add(islandNames.get(currentIsland));
                        
                Gdx.app.log("voted", voted + "");
                        
                PropertiesSingleton.getInstance().setChoosenIsland(islandNames.get(currentIsland));*/

                //app.setScreen(new ChooseBallScreen(app));
            }
        });

        item1Button.setPosition(0, -item1Button.getHeight());
        voteButtons.add(item1Button);
        stage.addActor(voteButtons.get(i));
    }

    voteButtons.get(currentIsland).setPosition(Gdx.graphics.getHeight() / 2 - accept.getWidth() / 2,
            accept.getHeight());

    InputMultiplexer inputMultiplexer = new InputMultiplexer();
    inputMultiplexer.addProcessor(stage);
    inputMultiplexer.addProcessor(new GestureDetector(0.0f, 0.0f, 0.0f, 5f, this));
    Gdx.input.setInputProcessor(inputMultiplexer);
}

From source file:net.bplaced.therefactory.nomoore.screens.ScreenGame.java

License:Open Source License

public ScreenGame(MyGdxGame myGdxGame) {
    this.myGdxGame = myGdxGame;
    batch = myGdxGame.batch;//from  w  w w .j a va2s.  c  om
    sr = myGdxGame.sr;
    viewport = myGdxGame.viewport;
    camera = myGdxGame.camera;
    font = myGdxGame.font;

    gestureDetector = new GestureDetector(20, .5f, 2, .15f, this);

    musicMainTheme = MediaManager.getMusic("music/3_mainTheme.mp3");
    musicMainTheme.setLooping(true);

    musicCreepy = MediaManager.getMusic("music/creepyDrums.mp3");
    musicCreepy.setLooping(true);

    soundSecretFound = MediaManager.getSound("music/secretFound.mp3");
    soundIHavePaintedTheStone = MediaManager.getSound("music/iHavePaintedTheStone_sound.mp3");
    soundCut = MediaManager.getSound("music/cut.mp3");
    soundFireIgnited = MediaManager.getSound("music/fireIgnited.mp3");
    soundItemPickup = MediaManager.getSound("music/item_pickup.mp3");

    touchCoordinates = new Vector2();
    unprojectedCoordinates = new Vector2();
    previousPositionOfRightHandle = new Vector2();
    previousPositionOfLeftHandle = new Vector2();

    rectangleRightHandle = new Rectangle();
    rectangleRightHandle.setSize(32, 220);
    rectangleLeftHandle = new Rectangle();
    rectangleLeftHandle.setSize(rectangleRightHandle.width, rectangleRightHandle.height);

    handle = new Sprite(new Texture("sprites/handle.png"));

    // backgrounds
    Texture textureModernTimes = new Texture("sprites/blue.png");
    regionModernTimes = new TextureRegion(textureModernTimes);
    textureMedieval = new Texture("sprites/red.png");
    regionMedieval = new TextureRegion(textureMedieval);
    Texture textureStoneAge = new Texture("sprites/orange.png");
    regionStoneage = new TextureRegion(textureStoneAge);

    rectangleRightHandle.setY((textureModernTimes.getHeight() / 2 - rectangleRightHandle.height / 2));
    rectangleLeftHandle.setY(rectangleRightHandle.getY());

    pic = new Sprite(new Texture("sprites/pic.png"));
    spriteStar = new Sprite(new Texture("sprites/star.png"));
    human1 = new Sprite(new Texture("sprites/human1.png"));

    interactablesModernTimes = new Array<Interactable>();
    interactablesMedieval = new Array<Interactable>();
    interactablesStoneAge = new Array<Interactable>();
    inventory = new Array<Interactable>();

    // -- modern times

    fridge = new Interactable("");
    fridge.setSprite(new Sprite(new Texture("sprites/fridge.png")));
    fridge.setPosition(130, 45);
    fridge.setConsumable(false);
    interactablesModernTimes.add(fridge);

    fridgeOpen = new Interactable("");
    fridgeOpen.setSprite(new Sprite(new Texture("sprites/fridge_open.png")));
    fridgeOpen.setPosition(130, 32);
    fridgeOpen.setConsumable(false);
    fridgeOpen.setVisible(false);
    interactablesModernTimes.add(fridgeOpen);

    fan = new Interactable("fan");
    fan.setSprite(new Sprite(new Texture("sprites/faecher.png")));
    fan.setPosition(70, 100);
    interactablesModernTimes.add(fan);

    daddy = new Interactable("");
    daddy.setSprite(new Sprite(new Texture("sprites/human.png")));
    daddy.setPosition(250, 25);
    daddy.setConsumable(false);
    interactablesModernTimes.add(daddy);

    Interactable easelWithCanvas = new Interactable("");
    easelWithCanvas.setSprite(new Sprite(new Texture("sprites/staffelei.png")));
    easelWithCanvas.setPosition(340, 30);
    easelWithCanvas.setConsumable(false);
    interactablesModernTimes.add(easelWithCanvas);

    easel = new Interactable("");
    easel.setSprite(new Sprite(new Texture("sprites/staffelei.png")));
    easel.setPosition(400, 30);
    easel.setConsumable(false);
    interactablesModernTimes.add(easel);

    canvas = new Interactable("canvas");
    canvas.setSprite(new Sprite(new Texture("sprites/papier.png")));
    canvas.setPosition(343, 49);
    canvas.setConsumable(false);
    interactablesModernTimes.add(canvas);

    milk = new Interactable("carton of milk");
    milk.setSprite(new Sprite(new Texture("sprites/milk.png")));
    milk.setPosition(130, 50);
    milk.setConsumable(false);
    milk.setVisible(false);
    interactablesModernTimes.add(milk);

    scalpel = new Interactable("scalpel");
    scalpel.setSprite(new Sprite(new Texture("sprites/scalpel.png")));
    scalpel.setPosition(220, 10);
    scalpel.setConsumable(false);
    interactablesModernTimes.add(scalpel);

    Interactable paper = new Interactable("");
    paper.setSprite(new Sprite(new Texture("sprites/papier.png")));
    paper.setPosition(343, 50);
    paper.setConsumable(false);
    interactablesModernTimes.add(paper);

    moore = new Interactable("");
    moore.setSprite(new Sprite(new Texture("sprites/girl.png")));
    moore.setPosition(412, 53);
    moore.setVisible(false);
    moore.setConsumable(true);
    interactablesModernTimes.add(moore);

    // -- medieval

    goblet = new Interactable("goblet");
    goblet.setSprite(new Sprite(new Texture("sprites/kelch.png")));
    goblet.setPosition(120, 102);
    goblet.setConsumable(false);
    interactablesMedieval.add(goblet);

    gobletBloody = new Interactable("goblet filled with blood");
    gobletBloody.setSprite(new Sprite(new Texture("sprites/kelchMitBlut.png")));
    gobletBloody.setVisible(false);
    gobletBloody.setPosition(130, 107);
    interactablesModernTimes.add(gobletBloody);

    fireplace = new Interactable("");
    fireplace.setSprite(new Sprite(new Texture("sprites/feuerstelle.png")));
    fireplace.setPosition(117, 40);
    fireplace.setConsumable(false);
    interactablesMedieval.add(fireplace);

    fireplaceUsed = new Interactable("");
    fireplaceUsed.setSprite(new Sprite(new Texture("sprites/fireplace_used.png")));
    fireplaceUsed.setPosition(110, 27);
    fireplaceUsed.setVisible(false);
    fireplaceUsed.setConsumable(false);
    interactablesMedieval.add(fireplaceUsed);

    firewood = new Interactable("pile of firewood");
    firewood.setSprite(new Sprite(new Texture("sprites/holz.png")));
    firewood.setPosition(30, 15);
    interactablesMedieval.add(firewood);

    charcoal = new Interactable("pile of charcoal");
    charcoal.setSprite(new Sprite(new Texture("sprites/holzkohle.png")));
    charcoal.setPosition(132, 35);
    charcoal.setVisible(false);
    charcoal.setConsumable(false);
    interactablesMedieval.add(charcoal);

    // -- stone age

    straw = new Interactable("pile of straw");
    straw.setSprite(new Sprite(new Texture("sprites/stroh.png")));
    straw.setPosition(50, 15);
    interactablesStoneAge.add(straw);

    rockPainted = new Interactable("");
    rockPainted.setSprite(new Sprite(new Texture("sprites/stein_angemalt.png")));
    rockPainted.setPosition(290, 20);
    rockPainted.setConsumable(false);
    interactablesStoneAge.add(rockPainted);

    rock = new Interactable("");
    rock.setSprite(new Sprite(new Texture("sprites/stein.png")));
    rock.setPosition(380, 30);
    rock.setConsumable(false);
    rock.setVisible(false);
    interactablesStoneAge.add(rock);

    flintstones = new Interactable("pair of flintstones");
    flintstones.setSprite(new Sprite(new Texture("sprites/feuersteine.png")));
    flintstones.setPosition(115, 35);
    interactablesStoneAge.add(flintstones);

    picBlack = new Interactable("");
    picBlack.setSprite(new Sprite(new Texture("sprites/pic_black.png")));
    picBlack.setVisible(false);
    picBlack.setPosition(400, 40);
    picBlack.setConsumable(false);
    interactablesStoneAge.add(picBlack);

    picWhite = new Interactable("");
    picWhite.setSprite(new Sprite(new Texture("sprites/pic_white.png")));
    picWhite.setPosition(415, 85);
    picWhite.setConsumable(false);
    picWhite.setVisible(false);
    interactablesStoneAge.add(picWhite);

    picRed = new Interactable("");
    picRed.setSprite(new Sprite(new Texture("sprites/pic_red.png")));
    picRed.setConsumable(false);
    picRed.setPosition(400, 45);
    picRed.setVisible(false);
    interactablesStoneAge.add(picRed);

    // init stars
    starPositionsX = new float[numStars];
    starPositionsY = new float[numStars];
    starSpeeds = new float[numStars];
    for (int i = 0; i < numStars; i++) {
        starPositionsX[i] = Utils.randomWithin(215, 250);
        starPositionsY[i] = 150;
        starSpeeds[i] = Utils.randomWithin(100, 400);
    }

    particles = new Particles();
}