Created
September 9, 2021 23:57
-
-
Save nasajpledu/34e5cef1b2278862267ecd96ce13bca5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameObject: | |
def __init__(self, image_path, x, y, width, height): | |
# Player image import and resize | |
object_image = pygame.image.load(image_path) | |
self.image = pygame.transform.scale(object_image, (width, height)) | |
self.x_pos = x | |
self.y_pos = y | |
self.width = width | |
self.height = height | |
# Draw the object by blitting it onto the background(game_screen) | |
def draw(self, background): | |
background.blit(self.image, (self.x_pos, self.y_pos)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment