starshipmeteors pygame the main play(method of the game class has loop that will continue until the user selects to quit the game they can do this in one of two wayseither by pressing the 'qkey (represented by the event key k_qor by clicking on the window close button in either case these events are picked up in the main event processing for loop within the main while loop method if the user does not want to quit the game then the display is updated (refreshedand then the clock tick((or framerate is set when the user selects to quit the game then the main while loop is terminated (the is_running flag is set to falseand the pygame quit(method is called to shut down pygame at the moment this not very interactive game as it does not do anything except allow the user to quit in the next section we will add in behaviour that will allow us to display the space ship within the display the gameobject class the gameobject class defines three methodsthe load_image(method can be used to load an image to be used to visually represent the specific type of game object the method then uses the width and height of the image to define the width and height of the game object the rect(method returns rectangle representing the current area used by the game object on the underlying drawing surface this differs from the images own rect(which is not related to the location of the game object on the underlying surface rects are very useful for comparing the location of one object with another (for example when determining if collision has occurredthe draw(method draws the gameobjectsimage onto the display_surface held by the game using the gameobjects current and coordinates it can be overridden by subclasses if they wish to be drawn in different way the code for the gameobject class is presented belowclass gameobjectdef load_image(selffilename)self image pygame image load(filenameconvert(self width self image get_width(self height self image get_height(def rect(self)""generates rectangle representing the objects location and dimensions ""