Here is the error I get:
Traceback (most recent call last):
File "C:\Users\Mendel Hornbacher\My programs\Spaceblaster\SpaceBlaster0.0.2b.py", line 95, in <module>
animate()
File "C:\Users\Mendel Hornbacher\My programs\Spaceblaster\SpaceBlaster0.0.2b.py", line 53, in animate
ship.hit(astroid_list)
File "C:\Users\Mendel Hornbacher\My programs\Spaceblaster\SpaceBlaster0.0.2b.py", line 34, in hit
if pygame.sprite.spritecollide(self, item, False):
File "C:\Python33\lib\site-packages\pygame\sprite.py", line 1515, in spritecollide
return [s for s in group if spritecollide(s.rect)]
TypeError: 'Astroid' object is not iterable
and these are the classes involved:
animate:
def animate(): ship.hit(astroid_list) ship.move() screen.fill([0,0,0]) astroid_list.draw(screen) screen.blit(ship.image, ship.rect) pygame.display.flip()
self.hit (in 'Ship' class)
def hit(self, group): for item in group: group.remove(item) if pygame.sprite.spritecollide(self, item, False): self.die() group.add(item)
astroid_list
astroid_list = pygame.sprite.Group()
If it means anything I'm running windows 8 pro. If the above code is not enough I'll post the whole code in a comment.