How would I determine if a rectangle bigger than the screen is in the screen. I have looked at: Determine if two rectangles overlap each other?, but it only applies to rectangles where one can fit within the other. My rectangles are like this (Blue is screen, red is object):
How can I detect if the red at any point is within the blue. I am doing this with python and pygame, so if there is a built in way to do this that would be great.
Thanks, Arkin
Pygame has set of methods to deal with rectangles. Your code might do something like.
Rect1.colliderect(Rect2)
Check out this link on handling Rectangles in Pygame... particularly the method pygame.Rect.colliderect
.