DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
bird_rect.centery += bird_movement
-
What is your question? I saw this too. It's simply a warning, and it won't stop your program from running. – 10 Rep Sep 23 '20 at 16:48
-
Ignoring deprecation warnings is a recipe for a bad time. – Carcigenicate Sep 23 '20 at 17:00
2 Answers
This is simply a Deprecation warning, and won't stop your program from running. All this is saying is that converting any variable to an integer with the __int__
method will not be included in future versions of python. This is related to pygame only, though.
From what I can tell, somewhere in your code, you have this line:
int(bird_movement)
When you blit that to an object, you get a floating point, which pygame does not consider a valid point. So pygame is just warning you, saying converting it to an integer with __int__()
is deprecated and may not be allowed later.
So you don't have to worry, for now at least.

- 2,217
- 7
- 19
- 33
bird_movemen
seems to be a floating point value, but pygame.Rect
can just store integral values, because the object is use for the pixel position of objects in the window. Track the position in an additional variable and round
the variabel before the assignment to bird_rect.centery
:
Initialization
bird_rect = pygame.Rect(....)
bird_centery = bird_rect.centery
movement:
bird_centery += bird_movement
bird_rect.centery = round(bird_centery)

- 202,892
- 27
- 131
- 174