I'm doing a little game and it was time for collision part. So in my game you can shoot bullets and kill enemies, but to detect collision I don't know what is better: rect.colliderect()
or sprite.spritecollide()
.
I'm working with sprite and what is the better to detect collision? I couldn't find anything on the internet to answer to my question.
def collision(self):
#if self.rect.colliderect(ennemi.rect):
#print("collision")
if pygame.sprite.spritecollide(bullet, ennemi_group, True):
print("collision")
def update(self):
...
self.collision()
...