Integer Argument Expected Got Float

pygame.draw.circle(screen, (128, 128, 128), (self.location<0>-1, self.location<1>-1), self.size+1)class Player(object): def __init__(self, name, colour): self.name = name self.colour = colour self.level = 1 self.feed = 0 self.dimension = 2 self.rate = 6 self.area = (SCREEN_SIZE<0>/2, SCREEN_SIZE<1>/2) self.location = self.place self.stopDis = 5 #Stopping distance def render(self, screen): pygame.draw.circle(display, (128, 128, 128), (self.location<0>-1, self.location<1>-1), self.size+1) #Error below pygame.attract.circle(display, self.colour, self.location, self.size) #Draw circle

You watching: Integer argument expected got float

*

*

The third parameter to pygame.draw.circle hregarding be a integral coordinate (tuple (x, y)), yet the outcome of a division (/) is a floationg suggest value.

Use int or round to actors self.area from floating point worths to integral values:

pygame.attract.circle(screen, (128, 128, 128), (int(self.location<0>-1), int(self.location<1>-1)), self.size+1)Or do a integral department (//) rather of the floating point department (/), when you calculate self.location:

self.area = (SCREEN_SIZE<0> // 2, SCREEN_SIZE<1> // 2)See additionally Numeric Types.


*

Thanks for contributing a response to Stack Overflow!

Please be certain to answer the question. Provide details and share your research!

But avoid

Asking for assist, clarification, or responding to other answers.Making statements based on opinion; ago them up with referrals or individual experience.

To learn more, check out our tips on creating great answers.


See more: Anthropology Mooc And Free Online Anthropology Course S, Online Anthropology Courses

Blog post Your Answer Discard

By clicking “Article Your Answer”, you agree to our terms of business, privacy plan and also cookie plan


Not the answer you're looking for? Browse various other inquiries tagged python python-3.x pygame or ask your very own question.


*

website architecture / logo © 2021 Stack Exadjust Inc; user contributions licensed under cc by-sa. rev2021.8.27.40079


Stack Overflow functions finest with JavaScript enabled
*

Your privacy

By clicking “Accept all cookies”, you agree Stack Exreadjust can save cookies on your tool and also disclose indevelopment in accordance through our Cookie Policy.