Question

I'm using the Slick2D Java game library and I want to set the scale of the graphics object that gets passed to the render method in my game loop. I'd like to do this outside the render method, so that I would only have to call the setScale() method once. I am implementing my game as StateBasedGame, so I'd to like to initialize my graphics object in my StateBasedGame class. Where would be the appropriate place to do this?

Was it helpful?

Solution

In the Init method, where you should be initializing your image. I can expand upon this, but your question seems to acknowledge that you already know how to scale the image.

EDIT: After rereading the question, the answer would be that you need to scale it every time you go into the render method of your gamestate object. This requires that you put graphics.scale(0.5f, 0.5f);

This is required, I believe, because the graphics object resets its scale every game tick so that you don't get a compounded effect as it calls the render method hundreds of times.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top