python pygame外星人入侵这个游戏疑问???烦劳大神指点,创建Group组的bullets为什么可以调用up_date()?它调用的谁的up_date()??

斜体样式def updata_screen(ai_settings,screen,ship,bullets):#创建方法 控制飞船的位置
screen.fill(ai_settings.bg_color)#填充屏幕
for bullet in bullets.sprites():
bullet.draw_bullet()
ship.blitme()#调用ship实例的blitme方法,画出飞船
pygame.display.flip()#设置让最近绘制的屏幕可见

def update_bullet(bullets):
bullets.update()
for bullet in bullets.copy():
if bullet.bullet_rect.bottom <= 0:
bullets.remove(bullet)

def fire_bullet(ai_settings,screen,ship,bullets):
if len(bullets) < ai_settings.bullets_allowed:
new_bullet = Bullet(ai_settings,screen,ship)
bullets.add(new_bullet)

你可能感兴趣的:(python)