So I drew a rectangle today:
my_rectangle = pygame.Rect(100, 100, 5, 5)
pygame.draw.rect(display, colour["black"], my_rectangle, 100)
Instead of drawing a thin bordered rectangle it draw a really big cross/plus sign.
This happened because i typed "100" instead of "1" for the border thickness when drawing the rect onto the screen.
But whats the logic behind this?
the border thickness grew so large that....?
anyone want to explain what you think or know has occurred?
See pygame.draw.rect()
:
rect(surface, color, rect, width=0) -> Rect
width (int) -- (optional) used for line thickness or to indicate that the rectangle is to be filled (not to be confused with the width value of the rect parameter)
- if width > 0, used for line thickness
Note When using width values > 1, the edge lines will grow outside the original boundary of the rect.
Therefore you are actually drawing 4 lines 5 in length but 100 in thickness along the edges of the rectangle. Since the lines are arranged in a square and are thicker than they are long, the final shape appears to be a cross.