size = width, height = 640,480
screen = pygame.display.set_mode ( size )
player = pygame.image.load('ball.bmp').convert()
background = pygame.image.load('bg.bmp').convert()
screen.blit(background, (0, 0))
objects = []
for x in range(10): #create 10 objects
o = GameObject(player, x*32, x)
objects.append(o)
while 1:
for event in pygame.event.get():
if event.type in ( pygame.QUIT, pygame.KEYDOWN):
sys.exit()
for o in objects:
screen.blit(background, o.pos, o.pos)
for o in objects:
o.move()
#screen.draw(o.image, o.pos)
screen.blit(o.image, o.pos) #draw new player
pygame.display.update()
pygame.time.delay(100)
本文源自:ht tp://w w w.c svt.ne t/