Package game.actors.mainmenu

Source Code of game.actors.mainmenu.PlayButtonActor

package game.actors.mainmenu;

import engine.geometry.Rectangle;
import engine.hierarchy.DefaultActor;
import game.habits.ClickHabit;
import game.scenes.FadeThroughBlackScene;
import game.scenes.LevelScene;
import game.terrain.ImageParser;

public final class PlayButtonActor extends DefaultActor implements ClickHabit.Listener {
    private Rectangle bounds;

    public PlayButtonActor(final Rectangle bounds) {
        this.bounds = bounds;
    }

    @Override
    public void onAdd() {
        addHabit(new ClickHabit(this, bounds));
    }

    @Override
    public void onClick(final ClickHabit click) {
        getStage().insertSceneAbove(new FadeThroughBlackScene(new LevelScene(ImageParser.makeDesertLevel())),
                getScene());
    }
}
TOP

Related Classes of game.actors.mainmenu.PlayButtonActor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.