I wrote the following program for the school where I need help. I can't find the error:
Breier\AppData\Local\Programs\Python\Python310\python.exe" "C:\Users\Max Breier\PycharmProjects\pythonProject\JaR\master.py" pygame 2.1.2 (SDL 2.0.18, Python 3.10.2) Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "C:\Users\Max Breier\PycharmProjects\pythonProject\JaR\master.py", line 321, in <module> main() File "C:\Users\Max Breier\PycharmProjects\pythonProject\JaR\master.py", line 74, in main Level1.Make_Tileset(IMAGE_LIBRARY) File "C:\Users\Max Breier\PycharmProjects\pythonProject\JaR\Terrain.py", line 28, in Make_Tileset for TILE in range(Chipset_Length - 1): TypeError: 'float' object cannot be interpreted as an integer Process finished with exit code 1 ```
Here is my code:
def Make_Tileset(self, IMAGE_LIBRARY):
Chipset_Length = self.Chipset.get_width() / 32
for TILE in range(Chipset_Length - 1):
self.TILE_DICT['Element_%s' % TILE] = self.Chipset.subsurface(32 * TILE, 0, 32, 32).convert_alpha()
self.TILE_DICT['Element_%s_fill' % TILE] = self.Chipset.subsurface(32 * TILE, 32, 32, 32).convert()
self.TILE_DICT['No_Element'] = IMAGE_LIBRARY['empty']
for Surface in self.TILE_DICT:
self.TILE_DICT[Surface] = pygame.transform.scale(self.TILE_DICT[Surface], self.SIZE_ON_SCREEN)