3
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
10 Rep
  • 2,217
  • 7
  • 19
  • 33
Jigsaw
  • 294
  • 1
  • 3
  • 14

2 Answers2

3

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.

10 Rep
  • 2,217
  • 7
  • 19
  • 33
1

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)
Rabbid76
  • 202,892
  • 27
  • 131
  • 174