I’m trying to get my camera to move, but all I have is a static map. Any idea what I might be doing wrong
public class MainGame implements Screen{
MJ mj;
SpriteBatch batch;
Sprite t;
Sprite a;
float delta = 1/60f;
TmxMapLoader tmap;
TiledMap map;
OrthogonalTiledMapRenderer mapRenderer;
OrthographicCamera camera;
public MainGame(MJ mj){
this.mj = mj;
}
public void render(float delta) {
Gdx.gl.glClearColor(1F, 1F, 1F, 1F);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
update(delta);
batch.setProjectionMatrix(camera.combined);
camera.update();
batch.begin();
mapRenderer.render();
batch.draw(t, 0, 0);
batch.draw(a, 0, 0);
batch.end();
}
public void update(float delta) {
if(Gdx.input.isKeyPressed(Keys.W))
camera.position.set(camera.position.x, camera.position.y + 10, camera.position.z);
}
public void resize(int width, int height) {
}
public void show() {
initMusic();
initImages();
}
void initMusic() {
}
void initImages() {
camera = new OrthographicCamera();
camera.setToOrtho(false, 1000, 1000/16*9);
batch = new SpriteBatch();
map = new TmxMapLoader().load("Map1.tmx");
mapRenderer = new OrthogonalTiledMapRenderer(map);
mapRenderer.setView(camera);
t = new Sprite(new Texture(Gdx.files.internal("testTile0.png")));
a = new Sprite(new Texture(Gdx.files.internal("sef.png")));
}