From e184e6417be536120283aca7f1e93868fa4b4b9a Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Sun, 5 Apr 2020 14:06:56 +0200 Subject: [PATCH] Entity now inherits from pygame.sprite.Sprite --- src/entities/Entity.py | 3 ++- src/entities/Player.py | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/entities/Entity.py b/src/entities/Entity.py index cda0aed..98dff66 100644 --- a/src/entities/Entity.py +++ b/src/entities/Entity.py @@ -2,10 +2,11 @@ from pathlib import Path import pygame -class Entity: +class Entity(pygame.sprite.Sprite): nextId = 1 def __init__(self, texture, pos): + super().__init__() self.image = texture self.rect = self.image.get_rect() self.rect.x = pos[0] diff --git a/src/entities/Player.py b/src/entities/Player.py index c51f272..667372b 100644 --- a/src/entities/Player.py +++ b/src/entities/Player.py @@ -5,14 +5,12 @@ from src.entities.Statistics import Statistics import pygame -class Player(Entity, pygame.sprite.Sprite): +class Player(Entity): def __init__(self, spawnpoint, size): - pygame.sprite.Sprite.__init__(self) - self.statistics = Statistics(100, 0, 0, 100) self.image, self.rect = Entity.getTexture("player.jpg", size) - super(Player, self).__init__(self.image, spawnpoint) + super().__init__(self.image, spawnpoint) # Where the player is facing, 0 - north, 1 self.rotation = Rotations.NORTH