2023-04-19 10:59:13 +02:00
|
|
|
import pygame
|
|
|
|
class tilemap(pygame.sprite.Sprite):
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
2023-04-22 12:45:53 +02:00
|
|
|
self.image = pygame.image.load("resources/roads2W.png").convert_alpha()
|
2023-04-19 12:23:30 +02:00
|
|
|
self.scaled_image = pygame.transform.scale(self.image, (self.image.get_width()*4, self.image.get_height()*4))
|
2023-04-19 10:59:13 +02:00
|
|
|
self.rect = self.image.get_rect()
|
|
|
|
self.rect = 0, 0
|
2023-04-19 12:23:30 +02:00
|
|
|
self.tilesize = self.scaled_image.get_width()/8
|
|
|
|
self.road_quer = self.scaled_image.subsurface((self.scaled_image.get_width()/8)*2, 0, self.scaled_image.get_height()/3, self.scaled_image.get_width()/8)
|
|
|
|
self.road_senkrecht = self.scaled_image.subsurface((self.scaled_image.get_width()/8)*3, 0, self.scaled_image.get_height()/3, self.scaled_image.get_width()/8)
|
|
|
|
self.road_btr = self.scaled_image.subsurface((self.scaled_image.get_width()/8)*0, (self.scaled_image.get_height()/3)*1, self.scaled_image.get_height()/3, self.scaled_image.get_width()/8)
|
|
|
|
self.road_tbr = pygame.transform.flip(self.scaled_image.subsurface((self.scaled_image.get_width()/8)*2, (self.scaled_image.get_height()/3)*1, self.scaled_image.get_height()/3, self.scaled_image.get_width()/8), True, False)
|
|
|
|
self.map_array = [[2, 0, 0, 0, 0],
|
|
|
|
[1, 0, 0, 0, 0],
|
|
|
|
[3, 0, 0, 0, 0],
|
|
|
|
[1, 0, 0, 0, 0],
|
2023-04-19 10:59:13 +02:00
|
|
|
[0, 0, 0, 0, 0]]
|