单击鼠标按钮时会生成多个对象

时间:2013-09-29 00:26:26

标签: python python-3.x pygame

for bullet in arrows:
    velx = math.cos(bullet[0]) * 10
    vely = math.sin(bullet[0]) * 10
    bullet[1] += velx
    bullet[2] += vely
    if bullet[1] < -64 or bullet[1] > 800 or bullet[2] < -64 or bullet[2] > 600:
        arrows.pop(index)
    for projectile in arrows:
        arrow1 = pygame.transform.rotate(arrow, 360 - projectile[0] * 57.29)
        screen.blit(arrow1, (projectile[1], projectile[2]))

for event in pygame.event.get():
    if event.type == MOUSEBUTTONDOWN:
        mousepos = pygame.mouse.get_pos()
        arrows.append([math.atan2(mouseY - Y, mouseX - X), playerpos1[0] + 36, playerpos1[1] + 36])

如上所述,射击了多个箭头。我无法理解!

0 个答案:

没有答案