Sure, just create a Rect
that is a little bit bigger than the Rect
of the Surface
using inflate
:
Returns a new rectangle with the size changed by the given offset. The rectangle remains centered around its current center. Negative values will shrink the rectangle.
s = your_surface # the Surface containing your image .
r = s.get_rect() # the rect of the Surface.
c_r = r.inflate(2, 2) # the rect used for collision detection.