#ecoding=utf-8
import pygame, sys

pygame.init()
screen = pygame.display.set_mode([640,480])
screen.fill([255,255,255])
my_ball = pygame.image.load("beach_ball.png")
x = 50
y = 50
x_speed = 5
# 增加垂直运动，变为2-D空间
y_speed = 5

while True:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			sys.exit()

	pygame.time.delay(20)
	pygame.draw.rect(screen, [255,255,255], [x,y,90,90], 0)# 擦掉前一个位置
	x = x + x_speed
	y = y + y_speed
	if x > screen.get_width():# 当球碰到最右边
		x = 0
	if y > screen.get_height():
		y = 0
	screen.blit(my_ball, [x, y])# 块移，将一个图像从一个地方复制到另一个地方
	pygame.display.flip()
#ecoding=utf-8
import pygame, sys

pygame.init()
screen = pygame.display.set_mode([640,480])
screen.fill([255,255,255])
my_ball = pygame.image.load("beach_ball.png")
x = 50
y = 50
x_speed = 5
# 增加垂直运动，变为2-D空间
y_speed = 5

while True:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			sys.exit()

	pygame.time.delay(20)
	pygame.draw.rect(screen, [255,255,255], [x,y,90,90], 0)# 擦掉前一个位置
	x = x + x_speed
	y = y + y_speed
	if x > screen.get_width():# 当球碰到最右边
		x = 0
	if y > screen.get_height():
		y = 0
	screen.blit(my_ball, [x, y])# 块移，将一个图像从一个地方复制到另一个地方
	pygame.display.flip()
#ecoding=utf-8 # 增加垂直运动，变为2-D空间 # 擦掉前一个位置 # 当球碰到最右边 # 块移，将一个图像从一个地方复制到另一个地方