【发布时间】:2017-05-11 01:11:54
【问题描述】:
我正在尝试制作投影运动的动画,但它不起作用。 只出现一个黑色窗口。
import math
import time
import pygame
V0 = int(input("please enter initial speed(m/s)"))
angle = int(input("please enter throwing angle"))
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
clock = pygame.time.Clock()
while not done:
T = time.clock()
x = int(math.cos(angle)*V0*T)
y = int((math.sin(angle)*V0*T)-1/2*(9.8*T*T))
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill(BLACK)
pygame.draw.circle(screen, WHITE, (x, y), 5, 0)
pygame.display.flip()
clock.tick(10)
pygame.quit()
我认为问题在于我的公式语句,但我不知道如何解决它。
【问题讨论】:
标签: python-3.x animation pygame