我想让“ball.giff”像这样在屏幕上转。
---> -->
|
^ v
|
|
^ v
| <-- <- -
和我的代码:
import sys
import pygame
size = width, height = 600, 600
screen = pygame.display.set_mode(size)
pygame.display.set_caption("wedding")
brade = pygame.image.load("ball.gif")
brade_rect = brade.get_rect()
speed = [10, 0]
black = 0, 0, 0
while True:
for event in pygame.event.get():
if event.type==pygame.QUIT:
pygame.quit()
sys.exit()
brade_rect.move_ip(speed)
if brade_rect.right>width:
speed = [0,10]
if brade_rect.bottom>height:
speed = [-10, 0]
if brade_rect.left<0:
speed = [0, -10]
if brade_rect.top<0:
speed = [10, 0]
pygame.time.delay(100)
screen.fill(black)
screen.blit(brade, brade_rect)
pygame.display.flip()
但有一个问题。一次巡回赛后,球永远向右。它不下去吗?我错过了什么,请你帮忙吗?