From bf304ffbe693d0d302847792173e08c69214d10d Mon Sep 17 00:00:00 2001 From: Armin Benz Date: Wed, 2 Aug 2017 22:04:56 +0200 Subject: [PATCH] Endtrigger wird aufgerufen --- .../colorrunner/game/renderer/CRGameRenderer.java | 10 ++++++++++ .../de/samdev/colorrunner/game/world/CRGameWorld.java | 2 +- .../game/world/entities/gameentities/PlayerEntity.java | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java b/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java index e408c9a..fddd01e 100644 --- a/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java +++ b/core/src/de/samdev/colorrunner/game/renderer/CRGameRenderer.java @@ -1,5 +1,6 @@ package de.samdev.colorrunner.game.renderer; +import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; import com.badlogic.gdx.graphics.g2d.TextureRegion; @@ -15,6 +16,8 @@ import de.samdev.colorrunner.game.world.entities.MovingEntity; import de.samdev.colorrunner.game.world.entities.gameentities.floor.FloorTileEntity; import de.samdev.colorrunner.game.world.map.provider.EndlessMapProvider; import de.samdev.colorrunner.game.world.map.provider.StaticMapProvider; +import de.samdev.colorrunner.screens.gameScreen.GameScreen; +import de.samdev.colorrunner.screens.menu.MainMenu; public class CRGameRenderer extends AbstractGameRenderer { private CRGameWorld gameworld; @@ -94,6 +97,13 @@ public class CRGameRenderer extends AbstractGameRenderer { shapeRenderer.rect(x*ftw+8, y*ftw+8, ftw-16, ftw-16); shapeRenderer.rect(x*ftw+12, y*ftw+12, ftw-24, ftw-24); break; + case END: + shapeRenderer.setColor(0, 1, 1, 1f); + shapeRenderer.rect(x*ftw+0, y*ftw+0, ftw-0, ftw-0); + shapeRenderer.rect(x*ftw+4, y*ftw+4, ftw-8, ftw-8); + shapeRenderer.rect(x*ftw+8, y*ftw+8, ftw-16, ftw-16); + shapeRenderer.rect(x*ftw+12, y*ftw+12, ftw-24, ftw-24); + break; case NOTHING: break; } diff --git a/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java b/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java index 32621e0..b870bcf 100644 --- a/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java +++ b/core/src/de/samdev/colorrunner/game/world/CRGameWorld.java @@ -30,7 +30,7 @@ public class CRGameWorld implements GameInputListener { public Rectangle camViewBoundaries = new Rectangle(); public MapProvider mapprovider; - private Music music; + public Music music; public int scoreMeter = 0; public CRGameWorld(MapProvider prov) { diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java index cb0490f..55c9ee7 100644 --- a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java +++ b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/PlayerEntity.java @@ -1,5 +1,6 @@ package de.samdev.colorrunner.game.world.entities.gameentities; +import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; @@ -15,6 +16,7 @@ import de.samdev.colorrunner.game.world.entities.gameentities.controller.FlyPlay import de.samdev.colorrunner.game.world.entities.gameentities.controller.RunTopPlayerController; import de.samdev.colorrunner.game.world.entities.gameentities.floor.FloorTileEntity; import de.samdev.colorrunner.game.world.map.provider.TriggerType; +import de.samdev.colorrunner.screens.menu.MainMenu; public class PlayerEntity extends MovingEntity { public final static float PLAYER_WIDTH = 31.9f; @@ -56,6 +58,10 @@ public class PlayerEntity extends MovingEntity { case GRAVITY: if (controller.getControllerType() != ControllingType.GRAVITY) controller = new GravityPlayerController(this); break; + case END: + ((Game)Gdx.app.getApplicationListener()).setScreen(new MainMenu()); + world.music.stop(); + break; } controller.update(delta);