import pygame import pygame.locals import sys pygame.init() displaysurface = pygame.display.set_mode((400,600)) mySurface1 =pygame.Surface((50,50)) mySurface2 = pygame.Surface((50, 100)) mySurface1.fill((0, 250, 0)) mySurface2.fill((0, 250, 0)) screen = pygame.display.set_mode((400,300)) background = pygame.Surface((400, 300)) surface = pygame.Surface((10, 10)) surface.fill((0,255,0)) pos = [175, 125] 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 : pos[0] +=20 pygame.display.update() screen.blit(background, (0, 0)) screen.blit(surface, pos) pygame.display.update()