group the method looks for any member of the group that' collided with the sprite and stops looping through the group as soon as it finds one member that has collided with the sprite hereit loops through the group aliens and returns the first alien it finds that has collided with ship if no collisions occurspritecollideany(returns none and the if block at won' execute if it finds an alien that' collided with the shipit returns that alien and the if block executesit prints ship hit!! (when an alien hits the shipwe'll need to do number of taskswe'll need to delete all remaining aliens and bulletsrecenter the shipand create new fleet before we write code to do all thiswe need to know that our approach for detecting alien-ship collisions works correctly writing print statement is simple way to ensure we're detecting collisions properly now we need to pass ship to update_aliens()alien_ invasion py start the main loop for the game while truegf check_events(ai_settingsscreenshipbulletsship update(gf update_bullets(ai_settingsscreenshipaliensbulletsgf update_aliens(ai_settingsshipaliensgf update_screen(ai_settingsscreenshipaliensbulletsnow when you run alien invasionship hit!!should appear in the terminal whenever an alien runs into the ship when testing this featureset alien_drop_speed to higher value such as or so that the aliens will reach your ship faster responding to alien-ship collisions now we need to figure out what happens when an alien collides with the ship instead of destroying the ship instance and creating new onewe'll count how many times the ship has been hit by tracking statistics for the game (tracking statistics will also be useful for scoring let' write new classgamestatsto track game statisticsand save it as game_stats pygame_stats py class gamestats()"""track statistics for alien invasion "" def __init__(selfai_settings)"""initialize statistics ""self ai_settings ai_settings self reset_stats(def reset_stats(self)"""initialize statistics that can change during the game ""self ships_left self ai_settings ship_limit we'll make one gamestats instance for the entire time alien invasion is runningbut we'll need to reset some statistics each time the player starts aliens