def update_catcher(ai_settings, screen, catcher): screen_rect = screen.get_rect() catcher.update(ai_settings, screen) if len(catcher) == 0: c = Catcher(screen) c.center = screen_rect.centerx c.rect.centerx = c.center c.rect.bottom = screen_rect.bottom catcher.add(c)
def update_catcher(ai_settings, screen, catcher): screen_rect = screen.get_rect() catcher.update(ai_settings, screen) if len(catcher) == 0: new_catcher = Catcher(ai_settings, screen) new_catcher.center = screen_rect.centerx new_catcher.rect.centerx = new_catcher.center new_catcher.rect.bottom = screen_rect.bottom catcher.add(new_catcher)
def update_catcher(ai_settings, screen, catcher): #get the rect screen position so can insert catcher_img screen_rect = screen.get_rect() catcher.update(ai_settings, screen) if len(catcher) == 0: # make a c variabe insantiate Catcher screen c = Catcher(ai_settings, screen) #at first center the catcher at screen centerx c.center = screen_rect.centerx #then the catcher rect centerx should align with c.center because have to user rect to insert the img c.rect.centerx = c.center #same center the rect_img bottom at screen bottom c.rect.bottom = screen_rect.bottom #add the catcher value from function and append the c class catcher.add(c)