I’m so confused right now. I’ve looked at many examples of drawing sprites with LibGDX and I’m almost certain that I’m doing it correctly. I debugged my code and it’s meant to be drawing my sprite at (0, 0). Here is my code:
Initialized in show method:
public Player(int x, int y) {
if(x >= 0 && y >= 0)
position = new Vector2(x, y);
else
throw new IllegalArgumentException(Integer.toString(x) +" "+ Integer.toString(y));
character = new Texture("character.png");
sprite = new Sprite(character);
sprite.setPosition(x, y);
batch = new SpriteBatch();
}
To draw it:
public void draw(OrthographicCamera camera) {
batch.setProjectionMatrix(camera.combined);
batch.begin();
sprite.draw(batch);
batch.end();
}
Maybe I’m missing something really obvious? ???
Those early stages of the project when the simple things don’t work and you want to bash your head in and just forget you ever even heard of coding… yeah I have those too!