The goal is to generate 25 objects using the same class.
I am currently using this code to create the object:
class Card:
def __init__(self,pos):
self.flipping = False
self.images = loadanimationimages()
self.frame = 0
self.pos = pos
def flip():
self.flipping = True
def update():
if self.flipping:
self.frame += 1
self.frame %= len(self.images)
def draw(screen):
screen.blit(pygame.transform.smoothscale(self.images[self.frame],
self.pos),55*scale).convert_alpha() #Continued.
def updatecards(): #Create the cards.
cards = []
for x in range(5):
for y in range(5):
cards.append(Card((x*92*scale+offsetx*scale,y*92*scale+offsety*scale)))
I know I have to call card.flip()
but I don't know how to call the individual cards. Help?