0

I am making a game where you have to shoot asteroids before they hit you, but I cant figure out how to collide my Bullet(sprite) with a list variable.

Here is my Bullet Class:

class Bullets(pg.sprite.Sprite):
    def __init__(self, x, y):
        pg.sprite.Sprite.__init__(self)
        self.image = pg.image.load("Asteroid shootout/pixel_laser_red.png")
        self.rect = self.image.get_rect()
        self.x = x
        self.y = y
        self.rect.center = [self.x, self.y]

    def update(self):
        self.rect.y -= 5
        

Here is my Asteroid info:

asteroid_size = 40
asteroid_pos = [random.randint(0, width-asteroid_size), 0]
asteroid_list = [asteroid_pos]

and I couldnt figure out how to collide these two, any help?

Leonardo
  • 1
  • 1

0 Answers0