DSZI_Survival/src/game/TerrainTile.py
Wirus 853a3b1601 Map: collidable group of sprites
TerrainTile: position attributes
EventManager: collision method
2020-04-05 19:08:08 +02:00

18 lines
612 B
Python

import pygame
import os
from os import path
class TerrainTile(pygame.sprite.Sprite):
def __init__(self, x, y, texture, tileSize):
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()
self.image = pygame.transform.scale(self.image, (tileSize, tileSize))
self.rect = self.image.get_rect()
self.x = x
self.y = y
self.rect.x = x * tileSize
self.rect.y = y * tileSize