ive got little time so i will be short to at least answer your question.
you need to pass in screen because the Ship object needs to know the size of the screen to be able to put hte ship in the center of the screen.
Regardless of the what you think currently, putting the ship content like this in the Ship class makes it much more organized and easier to identify and fix problems. As well as for others like us to understand. So its not complex by any means to us. The ships position, image, drawing ,etc are done inside the class. This clears up your main game loop which is what you want to constantly keep doing. As the Ship class starts to get bigger and bigger you will understand why its all in a class.
you need to pass in screen because the Ship object needs to know the size of the screen to be able to put hte ship in the center of the screen.
(Sep-11-2018, 06:22 AM)TheHumbleIdiot Wrote: self.rect.centerx = self.screen_rect.centerx #What the hell is this doing? I have no idea.you are setting the center screen x position (from left to right) to the Ship's object center and setting the rects bottom to the bottom of the screen. This will put the ship in the center of the screen width wise, but at the top-down wise. Pygame rects have positions and you can move the image with the pygame rect instead of saving an x and y coordinate yourself. This is why you blit the image to the rect position because you are moving the rect.
self.rect.bottom = self.screen_rect.bottom #Yet again the books explanation doesn't really help nor does google
Regardless of the what you think currently, putting the ship content like this in the Ship class makes it much more organized and easier to identify and fix problems. As well as for others like us to understand. So its not complex by any means to us. The ships position, image, drawing ,etc are done inside the class. This clears up your main game loop which is what you want to constantly keep doing. As the Ship class starts to get bigger and bigger you will understand why its all in a class.
Recommended Tutorials: