diff --git a/android/assets/levels/plevel001.tmx b/android/assets/levels/plevel001.tmx index d65c30c..41050cf 100644 --- a/android/assets/levels/plevel001.tmx +++ b/android/assets/levels/plevel001.tmx @@ -1,6 +1,6 @@ - + @@ -4051,113 +4051,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4265,401 +4158,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -5036,1113 +4536,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -6267,7 +4660,7 @@ - + @@ -6767,7 +5160,7 @@ - + @@ -7267,7 +5660,7 @@ - + @@ -7767,7 +6160,7 @@ - + @@ -8267,7 +6660,7 @@ - + @@ -8767,6 +7160,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -9124,6 +7660,1470 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -9546,14 +9546,14 @@ - - - - - - - - + + + + + + + + @@ -14056,7 +14056,7 @@ - + @@ -19056,7 +19056,7 @@ - + diff --git a/core/src/de/samdev/colorrunner/game/world/entities/GravityEntity.java b/core/src/de/samdev/colorrunner/game/world/entities/GravityEntity.java index cb35bb7..23082dc 100644 --- a/core/src/de/samdev/colorrunner/game/world/entities/GravityEntity.java +++ b/core/src/de/samdev/colorrunner/game/world/entities/GravityEntity.java @@ -1,12 +1,12 @@ package de.samdev.colorrunner.game.world.entities; import de.samdev.colorrunner.game.world.CRGameWorld; -import de.samdev.colorrunner.game.world.entities.gameentities.GetTriggerType; +import de.samdev.colorrunner.game.world.entities.gameentities.ControllingType; public abstract class GravityEntity extends MovingEntity { public float GRAVITY_FORCE = 700f; public final static float TERMINAL_VELOCITY = 900f; - public GetTriggerType getType = GetTriggerType.RUNBOTTOM; + public ControllingType ctrlType = ControllingType.RUNBOTTOM; public GravityEntity(CRGameWorld _owner, float width, float height) { this(_owner, 0, 0, width, height); @@ -19,7 +19,7 @@ public abstract class GravityEntity extends MovingEntity { @Override public void update(float delta) { - switch (getType){ + switch (ctrlType){ case RUNTOP: GRAVITY_FORCE = -700; break; diff --git a/core/src/de/samdev/colorrunner/game/world/entities/MovingEntity.java b/core/src/de/samdev/colorrunner/game/world/entities/MovingEntity.java index d26a79a..c8e945f 100644 --- a/core/src/de/samdev/colorrunner/game/world/entities/MovingEntity.java +++ b/core/src/de/samdev/colorrunner/game/world/entities/MovingEntity.java @@ -10,8 +10,8 @@ import de.samdev.colorrunner.game.world.CRGameWorld; public abstract class MovingEntity extends CRGameEntity { protected Vector2 velocity = new Vector2(); - public final static float EPSILON = 1e-8f; - public final static float EPSILON_TOUCH = 5e-8f; + public final static float EPSILON = 1e-4f; + public final static float EPSILON_TOUCH = 5e-4f; private boolean face_TOP_isTouching = false; private boolean face_LEFT_isTouching = false; @@ -134,26 +134,29 @@ public abstract class MovingEntity extends CRGameEntity { if (isTouching_LEFT() && ! isTouching_RIGHT()) { next.width += add; - next.x -= add; } else if (! isTouching_LEFT() && isTouching_RIGHT()) { next.width += add; + next.x -= add; + next.x -= EPSILON; } else { next.width += add; next.x -= add/2; } if (add < 0) { - bounds.set(next); - for (CRGameEntity ent2 : world.entities) { //TODO rem me - if (ent2 == this) continue; + if (CRGame.DEBUG) { + for (CRGameEntity ent2 : world.entities) { + if (ent2 == this) continue; - if (overlaps(next, ent2.bounds) && ent2.canCollide(false, this)) { - Gdx.app.log("Entity Hitbox", "Expand failed X- || WTF"); - return false; + if (overlaps(next, ent2.bounds) && ent2.canCollide(false, this)) { + Gdx.app.log("Entity Hitbox", "Expand failed X- || WTF"); + return false; + } } } + bounds.set(next); return true; } else { for (CRGameEntity ent : world.entities) { @@ -206,24 +209,27 @@ public abstract class MovingEntity extends CRGameEntity { next.height += add; } else if (! isTouching_BOTTOM() && isTouching_TOP()) { next.height += add; - next.y -= add - EPSILON; + next.y -= add; + next.y -= EPSILON; } else { next.height += add; next.y -= add/2; } if (add < 0) { - bounds.set(next); - for (CRGameEntity ent2 : world.entities) { //TODO rem me - if (ent2 == this) continue; + if (CRGame.DEBUG) { + for (CRGameEntity ent2 : world.entities) { + if (ent2 == this) continue; - if (overlaps(next, ent2.bounds) && ent2.canCollide(false, this)) { - Gdx.app.log("Entity Hitbox", "Expand failed Y- || WTF"); - return false; + if (overlaps(next, ent2.bounds) && ent2.canCollide(false, this)) { + Gdx.app.log("Entity Hitbox", "Expand failed Y- || WTF"); + return false; + } } } + bounds.set(next); return true; } else { for (CRGameEntity ent : world.entities) { diff --git a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/GetTriggerType.java b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java similarity index 83% rename from core/src/de/samdev/colorrunner/game/world/entities/gameentities/GetTriggerType.java rename to core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java index 139b5d9..6a76797 100644 --- a/core/src/de/samdev/colorrunner/game/world/entities/gameentities/GetTriggerType.java +++ b/core/src/de/samdev/colorrunner/game/world/entities/gameentities/ControllingType.java @@ -4,6 +4,6 @@ package de.samdev.colorrunner.game.world.entities.gameentities; * Created by benza on 23.04.2017. */ -public enum GetTriggerType { +public enum ControllingType { RUNBOTTOM, RUNTOP, FLY, NOTHING } 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 73b7804..9169d5c 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,6 +1,5 @@ package de.samdev.colorrunner.game.world.entities.gameentities; -import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; @@ -11,14 +10,10 @@ import de.samdev.colorrunner.game.world.entities.CRGameEntity; import de.samdev.colorrunner.game.world.entities.GravityEntity; 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; - -import static de.samdev.colorrunner.game.world.map.provider.TriggerType.RUNBOTTOM; -import static de.samdev.colorrunner.game.world.map.provider.TriggerType.RUNTOP; public class PlayerEntity extends GravityEntity { - public final static float PLAYER_WIDTH = 32; - public final static float PLAYER_HEIGHT = 32; + public final static float PLAYER_WIDTH = 31.9f; + public final static float PLAYER_HEIGHT = 31.9f; public final static float PLAYER_JUMP_FORCE = 356f; public final static float PLAYER_FLY_FORCE = 250f; @@ -30,10 +25,7 @@ public class PlayerEntity extends GravityEntity { private SwipeDirection phase = SwipeDirection.UP; - private boolean doFly = false; - private TriggerType triggerType; - public PlayerEntity(CRGameWorld _owner, float x, float y) { super(_owner, x, y, PLAYER_WIDTH, PLAYER_HEIGHT); @@ -45,35 +37,33 @@ public class PlayerEntity extends GravityEntity { velocity.x += PLAYER_SPEED_FORCE * delta; if (doFly) { - if ( getType == GetTriggerType.RUNBOTTOM) + if ( ctrlType == ControllingType.RUNBOTTOM) velocity.y += PLAYER_FLY_FORCE * delta; - else if(getType == GetTriggerType.RUNTOP) + else if(ctrlType == ControllingType.RUNTOP) velocity.y += -PLAYER_FLY_FORCE * delta; } doFly = false; updateRotation(delta); - triggerType = world.mapprovider.getTrigger((int)(bounds.x / FloorTileEntity.FLOORTILE_WIDTH), (int)(bounds.y / FloorTileEntity.FLOORTILE_HEIGHT)); - - switch (triggerType){ + TriggerType trigger = world.mapprovider.getTrigger((int)((bounds.x + bounds.width/2f) / FloorTileEntity.FLOORTILE_WIDTH), (int)((bounds.y + bounds.height/2f) / FloorTileEntity.FLOORTILE_HEIGHT)); + switch (trigger){ case RUNTOP: - getType = GetTriggerType.RUNTOP; + ctrlType = ControllingType.RUNTOP; break; case RUNBOTTOM: - getType = GetTriggerType.RUNBOTTOM; + ctrlType = ControllingType.RUNBOTTOM; break; case FLY: - getType = GetTriggerType.FLY; + ctrlType = ControllingType.FLY; break; } - super.update(delta); } private void updateRotation(float delta) { - boolean touch = false; //isTouching_ANY(); //TODO comment me to force bug + boolean touch = isTouching_ANY(); boolean aligned = (visualRotation % 90 == 0); if (!touch) @@ -109,9 +99,9 @@ public class PlayerEntity extends GravityEntity { } public void jump() { - if (isTouching_BOTTOM() && getType == GetTriggerType.RUNBOTTOM) + if (isTouching_BOTTOM() && ctrlType == ControllingType.RUNBOTTOM) velocity.y = PLAYER_JUMP_FORCE; - else if(isTouching_TOP() && getType == GetTriggerType.RUNTOP) + else if(isTouching_TOP() && ctrlType == ControllingType.RUNTOP) velocity.y = -PLAYER_JUMP_FORCE; } @@ -129,9 +119,9 @@ public class PlayerEntity extends GravityEntity { } public void fly() { - if (!isTouching_BOTTOM() && getType == GetTriggerType.RUNBOTTOM) + if (!isTouching_BOTTOM() && ctrlType == ControllingType.RUNBOTTOM) doFly = true; - else if(isTouching_TOP() && getType == GetTriggerType.RUNTOP) + else if(isTouching_TOP() && ctrlType == ControllingType.RUNTOP) doFly = true; } diff --git a/core/src/de/samdev/colorrunner/input/CRGameInputProcessor.java b/core/src/de/samdev/colorrunner/input/CRGameInputProcessor.java index 8f30ba8..f785464 100644 --- a/core/src/de/samdev/colorrunner/input/CRGameInputProcessor.java +++ b/core/src/de/samdev/colorrunner/input/CRGameInputProcessor.java @@ -133,25 +133,25 @@ public class CRGameInputProcessor implements InputProcessor, GestureListener { @Override public boolean pan(float x, float y, float deltaX, float deltaY) { - // TODO Auto-generated method stub + // NOP return false; } @Override public boolean panStop(float x, float y, int pointer, int button) { - // TODO Auto-generated method stub + // NOP return false; } @Override public boolean zoom(float initialDistance, float distance) { - // TODO Auto-generated method stub + // NOP return false; } @Override public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) { - // TODO Auto-generated method stub + // NOP return false; } diff --git a/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java b/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java index 78d6ad6..80a846d 100644 --- a/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java +++ b/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java @@ -18,8 +18,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; -import de.samdev.colorrunner.screens.gameScreen.GameScreen; - public class OptionMenuScreen implements Screen{ private Preferences prefs = Gdx.app.getPreferences("settings"); @@ -58,8 +56,7 @@ public class OptionMenuScreen implements Screen{ @Override public void resize(int width, int height) { - // TODO Auto-generated method stub - + // NOP } @Override @@ -116,13 +113,13 @@ public class OptionMenuScreen implements Screen{ @Override public void pause() { - // TODO Auto-generated method stub + // NOP } @Override public void resume() { - // TODO Auto-generated method stub + // NOP } diff --git a/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java b/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java index bb97669..73fbcd5 100644 --- a/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java +++ b/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java @@ -9,8 +9,6 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.MathUtils; -import de.samdev.colorrunner.CRGame; - public class SplashScreen implements Screen { @@ -47,7 +45,7 @@ public class SplashScreen implements Screen { @Override public void resize(int width, int height) { - // TODO Auto-generated method stub + // NOP } @@ -71,13 +69,13 @@ public class SplashScreen implements Screen { @Override public void pause() { - // TODO Auto-generated method stub + // NOP } @Override public void resume() { - // TODO Auto-generated method stub + // NOP }