So I am playing around, testing stuff etc… And I saw this :
First one is like okey, but i walk down and WTF?
I am using slick2D, Code:
private Player p;
private StrangeMan sm;
public void init(GameContainer c, StateBasedGame game) throws SlickException {
sm = new StrangeMan(300,300);
p = new Player(100, 100,AnimationHandler.Player);
}
public void render(GameContainer c, StateBasedGame game, Graphics g) throws SlickException {
g.translate(-p.getX()+c.getWidth()/2-p.getWidth()/2,-p.getY()+c.getHeight()/2-p.getHeight()/2);
p.render(c, game, g);
sm.render(c, game, g);
}
The question : How can i make my player, when walks in front of the man, render/draw/whatever in front?