I want the bullets in my game to spawn randomly if different directions, I tried using this code that I found...but it didn't work. I changed the png and called out its function on the while loop but still no luck.
class Bullet(pygame.sprite.Sprite):
def init(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load("Bullet.png")
self.rect = self.image.get_rect()
self.dx = random.randrange(-10,10)
self.dy = random.randrange(-10,10)
def update(self):
self.rect.x += self.dx
self.rect.y += self.dy