import pygame class tilemap(pygame.sprite.Sprite): def __init__(self): super().__init__() self.image = pygame.image.load("resources/roads2W.png").convert_alpha() self.scaled_image = pygame.transform.scale(self.image, (self.image.get_width()*4, self.image.get_height()*4)) self.rect = self.image.get_rect() self.rect = 0, 0 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], [0, 0, 0, 0, 0]]