public MapObject[] getCollisionObject(Rectangle rect) {
		List<MapObject> objects = new ArrayList<MapObject>();

		// Iterate through the layers
		for (int i = 0; i < layers.size(); i++) {
			// Get the layer
			Layer layer = layers.get(i);

			// Is it an object group?
			if (layer instanceof ObjectGroup) {
				// We want all the objects
				MapObject[] layerObjects = ((ObjectGroup) layer).getObjects();
				for (int j = 0; j < layerObjects.length; j++) {
					MapObject object = layerObjects[j];
					// Does it have a GID?
					if (object.hasGID()) {
						// We need the tile width/height
						Tileset tileset = getTilesetByGID(object.getGID());
						int tilewidth = tileset.getTileWidth();
						int tileheight = tileset.getTileHeight();
						int objectx1 = object.getX();
						int objecty1 = object.getY();
						int objectx2 = tilewidth;
						int objecty2 = tileheight;

						Rectangle rectangle = new Rectangle(objectx1, objecty1, objectx2, objecty2);

						if (rect.intersects(rectangle)) {
							objects.add(object);
						}
					} else {
						int objectx1 = object.getX();
						int objecty1 = object.getY();
						int objectx2 = object.getWidth();
						int objecty2 = object.getHeight();

						Rectangle rectangle = new Rectangle(objectx1, objecty1, objectx2, objecty2);

						if (rect.intersects(rectangle)) {
							objects.add(object);
						}
					}
				}
			}
		}

		return objects.toArray(new MapObject[objects.size()]);
	}