“Cómo cambiar el color del cuadrado en Pygame con KeyPress” Código de respuesta

Cómo cambiar el color del cuadrado en Pygame con KeyPress

circlerect = pygame.draw.circle(SCREEN, COLOR, POS, RADIUS)
pygame.display.update(circlerect)
Vivacious Vicuña

Cómo cambiar el color del cuadrado en Pygame con KeyPress

while True:
    for events in pygame.event.get():
        if events.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        #Here for any commands inside the for loop  
        if (events.type == pygame.KEYDOWN) and (events.key == pygame.K_SPACE):
            COLOR = (random.randint(ZEROINTENSITY, MAXINTENSITY), random.randint(ZEROINTENSITY, MAXINTENSITY), random.randint(ZEROINTENSITY, MAXINTENSITY))
            #note- we have skipped the last parameter and by default, 0 is taken
     pygame.draw.circle(SCREEN, COLOR, POS, RADIUS)
     pygame.display.update()
Vivacious Vicuña

Respuestas similares a “Cómo cambiar el color del cuadrado en Pygame con KeyPress”

Preguntas similares a “Cómo cambiar el color del cuadrado en Pygame con KeyPress”

Más respuestas relacionadas con “Cómo cambiar el color del cuadrado en Pygame con KeyPress” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código