Entity now inherits from pygame.sprite.Sprite
This commit is contained in:
parent
277a84b72e
commit
e184e6417b
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user