[Slick2D] Level Bar Algorithm in Slick2D

Here is my code:


public void draw(Graphics g) {
	g.setColor(Color.gray);
	g.fillRect(x, GuiController.guiY, 200, 32);
	g.setColor(Color.black);
	g.drawRect(x, GuiController.guiY, 200, 32);
	g.setColor(Color.red);
	g.fillRect(x, GuiController.guiY, (PlayerStatController.xp / PlayerStatController.xpToGet) * 200, 32);
}

PlayerStatController is a class with static player variables and GuiController is basically a simple ArrayList class thing.

Anyways, when I run this code, theXP is increased, but the bar never changes. Therefore, you can’t see the change in your XP.

I’ve already looked a few tutorials and the code looked something similar to this:


int barWidth = 200;
int max = 100;
int current = //Current health
g.fillRect(x, y, (current / max) * 200, barHeight);

I tried to incorporate this as best as I could into my game. I think I put it in correctly, but it still isn’t working. So, I turned to you awesome guys.