0
"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()
하지만 문제가있다. 한 번 둘러 본 후에 공은 영원히 계속됩니다. 그것은 내려 가지 않습니다? 내가 놓친 것은 도움이 될 수 있습니까?
정말 고맙습니다. 나는 더 집중해야합니다. –
몇 장의 프린트를 추가하면 문제를 보았을 것입니다! – hivert
참으로, 나는 생각하고 있었다 :) 맞은 방법, 그런데 나는 나의 나쁜 영어에 대해 매우 유감이다. –