package tropicalescape;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;

import tropicalescape.physics.Hitbox;

public class Flag extends GameObject {

	static final int DESC_HEIGHT_SHIFT = 15;
	static final String IMG_FILE = "res/flag.png";

	String m_desc;
	static Image m_img;

	static {
		try {
			m_img = new Image(IMG_FILE);
		} catch (SlickException e) {
			e.printStackTrace();
		}
	}

	Flag(String desc, float x, float y) {
		super(new Hitbox());
		m_desc = desc;
		getPosition().x = x;
		getPosition().y = y;
	}

	@Override
	public void render(Graphics g) {
		m_img.draw();
		if (getPosition().y - DESC_HEIGHT_SHIFT < 0) {
			g.drawString(m_desc, 0, m_img.getHeight());
		} else {
			g.drawString(m_desc, 0, -DESC_HEIGHT_SHIFT);
		}
	}

	@Override
	public void update(int delta) {
	}
}

@@ -125,16 +125,56 @@
 ception;
+%0Aimport org.newdawn.slick.geom.Vector2f;
 %0A%0Aimport
@@ -668,19 +668,63 @@
 %7B%0A%09%09
-m_img.draw(
+Vector2f pos = getPosition();%0A%09%09m_img.draw(pos.x, pos.y
 );%0A%09
@@ -795,17 +795,21 @@
 m_desc, 
-0
+pos.x
 , m_img.
@@ -861,12 +861,23 @@
 sc, 
-0, -
+pos.x, pos.y - 
 DESC

Fix : Render du flag