What exactly is bugged?
If the type is the type of object, for instance only specific entity types should collide with each other, then this:
1 2 3 4
| if(rectangle1.intersects(rectangle2)) { if(entities.get(i).type.equals(tipo) || tipo == null) { |
Should be reversed. You should check to see if the types are the same before checking if their rectangles intersect.
No problem, I only had make something wrong, they are working good now.
And about the tipo, I've put them in the top of ifs. thanks both of you. and sorry for bad english