19 lines
555 B
Python
19 lines
555 B
Python
import os
|
|
import pygame
|
|
|
|
class Tile(pygame.sprite.Sprite):
|
|
def __init__(self, id, type, field):
|
|
super().__init__()
|
|
self.id = id
|
|
x = id%16
|
|
y = id//16
|
|
self.type = type
|
|
self.field = field
|
|
if type=='grass':
|
|
self.image = pygame.image.load('images/grass.png').convert()
|
|
self.image = pygame.transform.scale(self.image, (64, 64))
|
|
self.rect = self.image.get_rect()
|
|
self.rect.topleft = (x * 64, y * 64)
|
|
|
|
def draw(self, surface):
|
|
self.tiles.draw(surface) |