更新 'bullet.py'

This commit is contained in:
201110504 2021-06-24 10:29:49 +08:00
parent ac50935e91
commit ccdef31cbe
1 changed files with 31 additions and 30 deletions

View File

@ -12,12 +12,13 @@ class Bullet(Sprite):
self.color = self.settings.bullet_color
# 在00处创建一个表示子弹的矩形再设置正确的位置
self.rect = pygame.Rect(0,0,self.settings.buttle_width,
self.rect = pygame.Rect(0, 0, self.settings.bullet_width,
self.settings.bullet_height)
self.rect.midtop = ai_game.ship.rect.midtop
# 储存用小数表示的子弹位置
self.y = float(self.rect.y)
def update(self):
"""向上移动子弹"""
# 更新表示子弹位置的小数值