import pygame, sys from pygame.locals import * import random rand1 = random.randint(1,255) rand2 = random.randint(1,255) rand3 = random.randint(1,255) pygame.init() screen = pygame.display.set_mode((1200,1000)) background = pygame.Surface((1200,1000)) pygame.display.set_caption('Lil bro is gonna go rainbow') surface = pygame.Surface((80,80)) surface.fill((rand1,rand2,rand3)) Pos = [400,400] while True : events = pygame.event.get() for event in events : if event.type == pygame.QUIT : pygame.quit() sys.exit() if event.type == pygame.KEYDOWN : if event.key == pygame.K_RIGHT : rand1 = random.randint(1,255) rand2 = random.randint(1,255) rand3 = random.randint(1,255) surface.fill((rand1,rand2,rand3)) Pos[0] += 40 if event.type == pygame.KEYDOWN : if event.key == pygame.K_LEFT : rand1 = random.randint(1,255) rand2 = random.randint(1,255) rand3 = random.randint(1,255) surface.fill((rand1,rand2,rand3)) Pos[0] -= 40 if event.type == pygame.KEYDOWN : if event.key == pygame.K_UP : rand1 = random.randint(1,255) rand2 = random.randint(1,255) rand3 = random.randint(1,255) surface.fill((rand1,rand2,rand3)) Pos[1] -= 40 if event.type == pygame.KEYDOWN : if event.key == pygame.K_DOWN : rand1 = random.randint(1,255) rand2 = random.randint(1,255) rand3 = random.randint(1,255) surface.fill((rand1,rand2,rand3)) Pos[1] += 40 screen.blit(background, (0,0)) screen.blit(surface, (Pos)) pygame.display.update()