UltimatePygameIntro
UltimatePygameIntro copied to clipboard
Enlarging score_rect no longer works
At approx 1:21:00 in the tutorial a pink rect is drawn behind the score and a second one is drawn as an outlined rectangle to make it larger. This worked because the border was drawn half inside and half outside the rect. This no longer works.
From the pygame site: "Changed in pygame 2.1.1: Drawing rects with width now draws the width correctly inside the rect's area, rather than using an internal call to draw.lines(), which had half the width spill outside the rect area."
A possible alternative could be something like:
pygame.draw.rect(screen,'Pink',score_rect.inflate(20,20))
This seems to draw an inflated box without permanently affecting the size of score_rect. I used a second pygame.draw() to confirm this by drawing score_rect in red without the inflate(). (Sorry, n00b here so I'm discovering as I write).