bullet py def update(self)"""move the bullet up the screen ""update the decimal position of the bullet self -self speed_factor update the rect position self rect self def draw_bullet(self)"""draw the bullet to the screen ""pygame draw rect(self screenself colorself rectu the update(method manages the bullet' position when bullet is firedit moves up the screenwhich corresponds to decreasing -coordinate valueso to update the positionwe subtract the amount stored in self speed_factor from self we then use the value of self to set the value of self rect the speed_factor attribute allows us to increase the speed of the bullets as the game progresses or as needed to refine the game' behavior once fireda bullet' -coordinate value never changesso it will only travel vertically in straight line when we want to draw bulletwe'll call draw_bullet(the draw rect(function fills the part of the screen defined by the bullet' rect with the color stored in self color storing bullets in group now that we have bullet class and the necessary settings definedwe can write code to fire bullet each time the player presses the spacebar firstwe'll create group in alien_invasion py to store all the live bullets so we can manage the bullets that have already been fired this group will be an instance of the class pygame sprite groupwhich behaves like list with some extra functionality that' helpful when building games we'll use this group to draw bullets to the screen on each pass through the main loop and to update each bullet' positionalien_ invasion py import pygame from pygame sprite import group --snip-def run_game()--snip-make ship ship ship(ai_settingsscreenmake group to store bullets in bullets group(start the main loop for the game while truegf check_events(ai_settingsscreenshipbulletsship update( ship that fires bullets