From 039ea1d18863f489d1359af9558df3a0c87c876a Mon Sep 17 00:00:00 2001 From: Kacper Kalinowski Date: Fri, 11 Mar 2022 13:00:11 +0100 Subject: [PATCH] refactor_agent2 --- agent.py | 16 ++++++++-------- main.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/agent.py b/agent.py index c87c891..3a9e165 100644 --- a/agent.py +++ b/agent.py @@ -1,14 +1,14 @@ import pygame.image - class trashmaster(pygame.sprite.Sprite): - def __init__(self): + def __init__(self,x,y,img,vel): super().__init__() - self.images = [] - self.image = pygame.image.load("resources/textures/trashmaster_blu.png") - self.image = pygame.transform.scale(self.image, (16, 16)) - self.images.append(self.image) + self.x=x + self.y=y + self.img = img + self.velocity = vel + + self.image = pygame.image.load(img) + self.image = pygame.transform.scale(self.image, (self.x,self.y)) self.rect = self.image.get_rect() - - garbagetruck_list = pygame.sprite.Group() diff --git a/main.py b/main.py index d67bfa6..443890b 100644 --- a/main.py +++ b/main.py @@ -34,7 +34,7 @@ def main(): game = WalleGame() game.update_window() - smieciara_object = trashmaster() + smieciara_object = trashmaster(16,16,"resources/textures/trashmaster_blu.png",16) game.draw_trashmaster(smieciara_object) game.update_window()