import sys, pygame
pygame.init()
size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0
white = 255,255,255
green = 0,255,0
screen = pygame.display.set_mode(size)
x=10
deplacementX=1
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
screen.fill(white)
x=x+deplacementX
pygame.draw.rect(screen,green,[x,50,50,50])
if (x<0): deplacementX +=1
if (x>320): deplacementX -=1
pygame.display.flip()
Aucun commentaire:
Enregistrer un commentaire