wall border and sticky description
This commit is contained in:
+17
-1
@@ -63,6 +63,8 @@ class Map:
|
||||
# gibt True zurück, wenn der Spieler das Tile betreten darf
|
||||
return self.get_tile(column, row) in ("R", "D,", "H", "S")
|
||||
|
||||
|
||||
# Funktion, um die Map zu erstellen
|
||||
def draw_map(self, surface: pygame.Surface, font: pygame.font.Font, cam_x: int = 0, cam_y: int = 0) -> None:
|
||||
|
||||
# Dict, dass jedem Buchstaben eine Farbe zuordnet
|
||||
@@ -97,9 +99,23 @@ class Map:
|
||||
pygame.draw.rect(surface, color, rect)
|
||||
|
||||
# die Wände sollen einen zusätzlichen Rand haben mit 1 = Wandbreite in Pixel
|
||||
if mark = "W":
|
||||
if mark == "W":
|
||||
pygame.draw.rect(surface, color_border, rect, 1)
|
||||
|
||||
# geht die Beschriftungen durch
|
||||
for i in range(len(self.room_decription)):
|
||||
# entpackt das Tupel in 3 Variablen: column, row, text
|
||||
column, row, text = self.room_decription[i]
|
||||
|
||||
# die Tile-Koordinaten in Pixel umrechnen und addieren von 2, damit der Text nicht ganz am Rand klebt
|
||||
px = column + tile_size - cam_x + 2
|
||||
py = row + tile_size - cam_y + 2
|
||||
|
||||
# Text-Bild mit fon.render()
|
||||
# True gibt eine glattere Schrift
|
||||
# blit() fixiert den Text auf dem Bildschirm
|
||||
surface.blit(font.render(text, True, color_text), (px, py))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user