Skip to content

Instantly share code, notes, and snippets.

@poemdexter
Created October 16, 2015 05:26
Show Gist options
  • Save poemdexter/4327426bccc76ef32441 to your computer and use it in GitHub Desktop.
Save poemdexter/4327426bccc76ef32441 to your computer and use it in GitHub Desktop.
forer code 2.0
float xOffset = arrayWid * (t.width / 2) + Gdx.graphics.getWidth() / 2;
float yOffset = arrayHei * (t.height / 2) + Gdx.graphics.getHeight() / 2;
public void render(SpriteBatch sb) {
sb.begin();
for (int x = 0; x < tileArray.length(); x++) {
for (int y = 0; y < tileArray[0].length(); y++) {
Texture texture = tileArray[x][y].background;
int posX = x * tileArray[x][y].width - xOffset;
int posY = y * tileArray[x][y].height - yOffset;
sb.draw(texture, posX, posY);
}
}
sb.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment