Fixed retarded Entity implementation

This commit is contained in:
Marcin Kostrzewski 2020-04-05 14:52:19 +02:00
parent 6efd5652dd
commit d88670f456

View File

@ -5,10 +5,9 @@ import pygame
class Entity(pygame.sprite.Sprite): class Entity(pygame.sprite.Sprite):
nextId = 1 nextId = 1
def __init__(self, texture, pos): def __init__(self, texture, size, pos):
super().__init__() super().__init__()
self.image = texture self.image, self.rect = self.getTexture(texture, size)
self.rect = self.image.get_rect()
self.rect.x = pos[0] self.rect.x = pos[0]
self.rect.y = pos[1] self.rect.y = pos[1]
self.id = self.getId() self.id = self.getId()
@ -20,8 +19,7 @@ class Entity(pygame.sprite.Sprite):
return id return id
# A method that returns image and rect from a file # A method that returns image and rect from a file
@staticmethod def getTexture(self, textureName, tileSize):
def getTexture(textureName, tileSize):
texturesFolder = "" texturesFolder = ""
textureFile = "" textureFile = ""
try: try: