diff --git a/src/game/Game.py b/src/game/Game.py index 1df88e4..6e6e8e4 100644 --- a/src/game/Game.py +++ b/src/game/Game.py @@ -42,7 +42,7 @@ class Game: # Start Map implement self.mapDataFolder = path.dirname("../data/mapdata/") - self.map = Map(path.join(self.mapDataFolder, 'map.txt'), self, self.screen) + self.map = Map(path.join(self.mapDataFolder, 'map.txt'), self.screen) # End Map implement self.mainLoop() diff --git a/src/game/Map.py b/src/game/Map.py index 7ed7db2..7ea843a 100644 --- a/src/game/Map.py +++ b/src/game/Map.py @@ -3,8 +3,7 @@ from game.TerrainTile import TerrainTile from game.Screen import Locations class Map: - def __init__(self, filename, game, screen): - self.game = game + def __init__(self, filename, screen): self.screen = screen self.terrain = [] self.entities = [] @@ -25,10 +24,10 @@ class Map: for row, tiles in enumerate(self.terrain): for col, tile in enumerate(tiles): if tile == 'w': - self.screen.draw(TerrainTile(self.game, col, row, 'wall.png', self.screen.mapSize), Locations.MAP, col, row) + self.screen.draw(TerrainTile(col, row, 'wall.png', self.screen.mapSize), Locations.MAP, col, row) if tile == ',': - self.screen.draw(TerrainTile(self.game, col, row, 'floor.png', self.screen.mapSize), Locations.MAP, col, row) + self.screen.draw(TerrainTile(col, row, 'floor.png', self.screen.mapSize), Locations.MAP, col, row) if tile == '.': - self.screen.draw(TerrainTile(self.game, col, row, 'grass.png', self.screen.mapSize), Locations.MAP, col, row) + self.screen.draw(TerrainTile(col, row, 'grass.png', self.screen.mapSize), Locations.MAP, col, row) diff --git a/src/game/TerrainTile.py b/src/game/TerrainTile.py index dcebdc8..c541760 100644 --- a/src/game/TerrainTile.py +++ b/src/game/TerrainTile.py @@ -4,11 +4,8 @@ from os import path class TerrainTile(pygame.sprite.Sprite): - def __init__(self, game, x, y, texture, mapSize): - self.tiles = [] - self.groups = game.spritesList - pygame.sprite.Sprite.__init__(self, self.groups) - self.game = game + def __init__(self, x, y, texture, mapSize): + super().__init__() self.imagesFolder = path.dirname("../data/images/") self.terrainFolder = path.join(self.imagesFolder, 'terrain') self.image = pygame.image.load(os.path.join(self.terrainFolder, texture)).convert()