You need to associate with the objects that will detect collision a Rectangle type variable (it is part of Slick2d). When constructing a Rectangle, the parameters x, y, width and height should be given and whenever this object moves, you should use setBounds to update such values.
As Rectangle extende Shape, you can use the Rectangle variable Intersects method by passing another Shape (in this case, the Rectangle of the other object that potentially collides) and using the returned Boolean to do any processing based on that event.
An example:
if (objectA.getRectangle().intersects(objectB.getRectangle())) {
System.out.println("Colisao detectada");
}
Where object and objectB are objects of your game, which have a position and a Rectangle (or any other Shape available on Slick2d) to be used as a collision box.
The processing of the collision depends on the type of game being played. Normally, we do not allow movement to occur if it causes a collision.
Slick2d Rectangle class documentation: http://slick.ninjacave.com/javadoc/org/newdawn/slick/geom/Rectangle.html
Hello, welcome to Stackoverflow in English. Your question is a little general and so it is difficult to help. Would it be possible to improve it a little? For example, adding information about what you’ve tried, or what kind of objects (are images?) you’re using?
– Luiz Vieira