dimanche 12 juin 2016

Choose different item from list each time in Python?

Right now I have this:

import pygame
import random

faces = [
    "trumpet.png",
    "trump2.png",
    "trump3.png"
]

    if mouse[0] > 225 and mouse[0] < 475 and mouse[1] > 475 and mouse[1] < 575 and event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
    image1 = pygame.image.load(random.choice(faces))

How do I make it so that each time I click, a different image from the faces list will appear?

Aucun commentaire:

Enregistrer un commentaire