after choosing an image for the shipwe need to display it onscreen to use our shipwe'll write module called shipwhich contains the class ship this class will manage most of the behavior of the player' ship ship py import pygame class ship()def __init__(selfscreen)"""initialize the ship and set its starting position ""self screen screen load the ship image and get its rect self image pygame image load('images/ship bmp'self rect self image get_rect(self screen_rect screen get_rect(start each new ship at the bottom center of the screen self rect centerx self screen_rect centerx self rect bottom self screen_rect bottom def blitme(self)"""draw the ship at its current location ""self screen blit(self imageself rectfirstwe import the pygame module the __init__(method of ship takes two parametersthe self reference and the screen where we'll draw the ship to load the imagewe call pygame image load( this function returns surface representing the shipwhich we store in self image once the image is loadedwe use get_rect(to access the surface' rect attribute one reason pygame is so efficient is that it lets you treat game elements like rectangles (rects)even if they're not exactly shaped like rectangles treating an element as rectangle is efficient because rectangles are simple geometric shapes this approach usually works well enough that no one playing the game will notice that we're not working with the exact shape of each game element when working with rect objectyou can use the xand -coordinates of the topbottomleftand right edges of the rectangleas well as the center you can set any of these values to determine the current position of the rect when you're centering game elementwork with the centercenterxor centery attributes of rect when you're working at an edge of the screenwork with the topbottomleftor right attributes when you're adjusting the horizontal or vertical placement of the rectyou can just use the and attributeswhich are the xand -coordinates of its top-left corner these attributes spare you from having to do calculations that game developers formerly had to do manuallyand you'll find you'll use them often ship that fires bullets