I can draw multiple sprites but they are all on top of each other at (0,0). How would I make each sprite appear after one another in a row?
My Rect class and Draw function:
class Rect(pygame.sprite.Sprite):
def __init__(self,color,width,height,value=0):
super().__init__()
self.image = pygame.Surface([width, height])
self.image.fill(color)
self.rect = self.image.get_rect()
self.value = value
self.x = 0
self.y = 0
def change_value(self,color,value):
self.image.fill(color)
self.value=value
def DrawRects():
rect1 = Rect(red, boxW, boxH)
rect2 = Rect(black, boxW, boxH)
rects.add(rect1, rect2)
rects.draw(screen)