我想在pygame中製作一個射手。我可以讓玩家四處移動,當按下空間時,子彈就會移動到其位置。我想知道如何讓它離開玩家,直到它碰到屏幕邊緣。這是我到目前爲止:在Pygame中拍攝
if AMMO > 0:
if event.type == pygame.KEYDOWN and Gun.image == NOGUN:
if event.key == pygame.K_SPACE and Gun.image == NOGUN:
Bullet.rect.center = Player.rect.center
if Player.direction == 0:
Bullet.direction = 0 #WHERE THE BULLET WILL MOVE
shot.play()
print "BANG"
AMMO = AMMO - 1
time.sleep(0.09)