added collision detection for EntityRectangles