added [R]eset
This commit is contained in:
parent
453d50f1c0
commit
a2d19985e7
|
@ -48,6 +48,12 @@ public abstract class AbstractGameRenderer {
|
||||||
cam.update();
|
cam.update();
|
||||||
updateCamMatrices();
|
updateCamMatrices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lookAtX < cam.position.x - cam.viewportWidth/2) {
|
||||||
|
cam.position.x += lookAtX - cam.position.x + cam.viewportWidth/2;
|
||||||
|
cam.update();
|
||||||
|
updateCamMatrices();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle getCamViewRectangle() {
|
public Rectangle getCamViewRectangle() {
|
||||||
|
|
|
@ -24,8 +24,8 @@ import de.samdev.colorrunner.input.GameInputListener;
|
||||||
public class CRGameWorld implements GameInputListener {
|
public class CRGameWorld implements GameInputListener {
|
||||||
public PlayerEntity player;
|
public PlayerEntity player;
|
||||||
|
|
||||||
public List<CRGameEntity> entities = new ArrayList<CRGameEntity>();
|
public List<CRGameEntity> entities;
|
||||||
public List<MapSection> sections = new ArrayList<MapSection>();
|
public List<MapSection> sections;
|
||||||
|
|
||||||
public FPSCounter fps = new FPSCounter();
|
public FPSCounter fps = new FPSCounter();
|
||||||
|
|
||||||
|
@ -34,9 +34,16 @@ public class CRGameWorld implements GameInputListener {
|
||||||
public Rectangle camViewBoundaries = new Rectangle();
|
public Rectangle camViewBoundaries = new Rectangle();
|
||||||
|
|
||||||
public CRGameWorld() {
|
public CRGameWorld() {
|
||||||
|
reinitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reinitialize() {
|
||||||
|
entities = new ArrayList<CRGameEntity>();
|
||||||
|
sections = new ArrayList<MapSection>();
|
||||||
|
|
||||||
addEntity(player = new PlayerEntity(this, 40, 290));
|
addEntity(player = new PlayerEntity(this, 40, 290));
|
||||||
|
|
||||||
mapRightBoundary = appendMap(CRMapStorage.map_start, new Vector2(mapRightBoundary, 0));
|
mapRightBoundary = appendMap(CRMapStorage.map_start, new Vector2(0, 0));
|
||||||
expandMap();
|
expandMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,4 +140,9 @@ public class CRGameWorld implements GameInputListener {
|
||||||
public void doFly() {
|
public void doFly() {
|
||||||
player.fly();
|
player.fly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
reinitialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.badlogic.gdx.InputProcessor;
|
||||||
import com.badlogic.gdx.input.GestureDetector.GestureListener;
|
import com.badlogic.gdx.input.GestureDetector.GestureListener;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
|
import de.samdev.colorrunner.CRGame;
|
||||||
import de.samdev.colorrunner.game.world.SwipeDirection;
|
import de.samdev.colorrunner.game.world.SwipeDirection;
|
||||||
|
|
||||||
public class CRGameInputProcessor implements InputProcessor, GestureListener {
|
public class CRGameInputProcessor implements InputProcessor, GestureListener {
|
||||||
|
@ -47,6 +48,12 @@ public class CRGameInputProcessor implements InputProcessor, GestureListener {
|
||||||
owner.doJump();
|
owner.doJump();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (keycode == Input.Keys.R && CRGame.DEBUG) {
|
||||||
|
owner.reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,5 @@ public interface GameInputListener {
|
||||||
public void doJump();
|
public void doJump();
|
||||||
public void doFly();
|
public void doFly();
|
||||||
public void switchColor(SwipeDirection sd);
|
public void switchColor(SwipeDirection sd);
|
||||||
|
public void reset();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user