123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package pathgame;
- import me.hammerle.snuviengine.api.IGame;
- import me.hammerle.snuviengine.api.Renderer;
- import pathgame.gameplay.Gamestate;
- import pathgame.gameplay.Gamestates;
- import pathgame.gameplay.Keys;
- import pathgame.gameplay.Level;
- import pathgame.gameplay.menu.Menu;
- import pathgame.rendering.LevelRenderer;
- import pathgame.rendering.MenuRenderer;
- public class PathGame implements IGame
- {
- private final Gamestate gamestate = new Gamestate();
- private final Level level = new Level();
- private final LevelRenderer levelRenderer = new LevelRenderer();
-
- private final Menu menu = new Menu();
- private final MenuRenderer menuRenderer = new MenuRenderer();
- public PathGame()
- {
- }
- @Override
- public void tick()
- {
- level.tick(gamestate);
- levelRenderer.tick(level, gamestate);
-
- menu.tick(gamestate, level);
-
- if(Keys.TEST_KEY.getTime() == 1)
- {
- //level.nextLevel();
- level.getPlayer().win(level.getMap());
- }
- }
- @Override
- public void renderTick(Renderer r, float lag)
- {
- if(gamestate.is(Gamestates.MENU))
- {
- levelRenderer.renderTick(r, 0.0f, level, gamestate);
- menuRenderer.renderTick(r, 0.0f, menu);
- }
- else
- {
- levelRenderer.renderTick(r, lag, level, gamestate);
- }
- }
- @Override
- public void onStop()
- {
- }
- }
|