Skip to main content
edited title
Link

How can I create a image and move ita created Image in Slick2D?

I want a image to follow the mouse, and I use Image class of Slick 2D.:

public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    mouseImage = new Image("res/mouse.png");
}
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics  graphics) throws SlickException {
    mouseImage.draw(0,0,0.1f);
}

But it seems that it does not have method for re-positioning a Image object. So how can I implement it (in update method)? Thanks.

I want a image to follow the mouse, and I use Image class of Slick 2D. But it seems that it does not have method for re-positioning a Image object. So how can I implement it? Thanks.

I want a image to follow the mouse, and I use Image class of Slick 2D:

public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    mouseImage = new Image("res/mouse.png");
}
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics  graphics) throws SlickException {
    mouseImage.draw(0,0,0.1f);
}

But it seems that it does not have method for re-positioning a Image object. So how can I implement it (in update method)? Thanks.

Source Link

How can I create a image and move it in Slick2D?

I want a image to follow the mouse, and I use Image class of Slick 2D. But it seems that it does not have method for re-positioning a Image object. So how can I implement it? Thanks.