Created Rect is bigger then circle in it, why?

Started by
5 comments, last by Zed McJack 11 years, 5 months ago
HI,

I started my Pong game and was wondering why is Rect bigger then the circle in it?
Advertisement
A link to your code would be useful.
From the looks of it, you have a circle image that most likely has excess empty space around it. Make sure you trim all the excess blank space off from around the circle so that the image is no larger than the square needed to contain the circle.

However I can't be 100% positive that this is the case. It helps to be a bit more verbose with what you expect, what actually happened, and what you tried to do in order to fix it. Relevant code doesn't hurt either ;)

Hopefully it's just that you need to trim the image to fit the circle better.

EDIT: I'm making more assumptions than I usually do. I'm assuming you're making a rect with the same dimensions as your image which you want to use.

A link to your code would be useful.

Sorry, I thought there is a reson for it beside my erronous code smile.png

def draw_circle(radius, color):

size = radius * 3

pict = pygame.Surface((size, size))

pygame.draw.circle( pict, color, (radius, radius), radius)

return pict, pict.get_rect()
>> size = radius * 3

The width of a circle is twice its radius, not three times its radius.

>> size = radius * 3

The width of a circle is twice its radius, not three times its radius.

Hey, where I was looking at? smile.png
Thanks a lot.
And when I have opportunity to ask...
Why is code segment in my replay in one row instead as it was in message editor? Should I add <br> to force new line?

This topic is closed to new replies.

Advertisement