zhishui_zxs 2022-07-24 13:23 采纳率: 33.3%
浏览 39

pygame外星人入侵游戏,子弹被拉长

外星人游戏,子弹被拉长了
#绘制子弹精灵

bullets = pygame.sprite.Group()

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
if len(bullets) < 5:
new_bullet = pygame.sprite.Sprite()
new_bullet.rect = pygame.Rect(0,0,3,15)
new_bullet.rect.midbottom = ship_rect.midtop
bullets.add(new_bullet)
print(len(bullets))

for bullet in bullets:
    pygame.draw.rect(screen_image,bg_color2,bullet.rect)
    bullet.rect.y -= 1

pygame.display.flip()

img

不知道哪里错了,请各位帮忙看下

  • 写回答

1条回答 默认 最新

  • 浪客 2022-07-24 13:42
    关注

    子弹每走一步都要刷新一下界面

    评论

报告相同问题?

问题事件

  • 创建了问题 7月24日

悬赏问题

  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能
  • ¥15 io.jsonwebtoken.security.Keys
  • ¥15 急,ubuntu安装后no caching mode page found等
  • ¥15 联想交换机NE2580O/NE1064TO安装SONIC
  • ¥15 防火墙的混合模式配置