map layout changes
This commit is contained in:
+32
-27
@@ -2,7 +2,7 @@ import pygame
|
|||||||
|
|
||||||
# Fenstergröße und Tile Größe (Felder)
|
# Fenstergröße und Tile Größe (Felder)
|
||||||
tile_size = 30
|
tile_size = 30
|
||||||
screen_w = 1800
|
screen_w = 1900
|
||||||
screen_h = 900
|
screen_h = 900
|
||||||
|
|
||||||
# Farben für die einzelnen Tiles
|
# Farben für die einzelnen Tiles
|
||||||
@@ -12,7 +12,8 @@ color_hall = (35, 65, 45) # dark green
|
|||||||
color_door = (40, 90, 110) # dark blue
|
color_door = (40, 90, 110) # dark blue
|
||||||
color_void = (10, 10, 15) # a little more black
|
color_void = (10, 10, 15) # a little more black
|
||||||
color_text = (220, 180, 210) # rose
|
color_text = (220, 180, 210) # rose
|
||||||
color_border = (55, 35, 70) # dark violet
|
color_border = (55, 35, 70)
|
||||||
|
color_start = (255, 0, 0)# dark violet
|
||||||
|
|
||||||
|
|
||||||
class Map:
|
class Map:
|
||||||
@@ -21,32 +22,36 @@ class Map:
|
|||||||
# Map wird mit "Tiles" (30x30 Feldern aufgebaut
|
# Map wird mit "Tiles" (30x30 Feldern aufgebaut
|
||||||
# W=Wall, R=Room, S=Start, H=Hall, D=Door
|
# W=Wall, R=Room, S=Start, H=Hall, D=Door
|
||||||
self.map = [
|
self.map = [
|
||||||
"WWWWWWWWWWWWWWWWWSSWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
|
"WWWWWWWWWWWWWWWWWWWHHSSHHWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
|
||||||
"WRRRRRRRRRRRRRRRWHHWRRRRRRRRRRRRRRRWRRRRRRRRRRRRRRRW",
|
"WWWWWWWWWWWWWWWWWWWHHHHHHWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
|
||||||
"WRRRRRRRRRRRRRRRWHHWRRRRRRRRRRRRRRRWRRRRRRRRRRRRRRRW",
|
"WWRRRRRRRRRRRRRRRWWHHHHHHWW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HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHWW",
|
||||||
|
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
|
||||||
|
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Raumbeschreibung in (Spalte, Zeile, Beschreibung)
|
# Raumbeschreibung in (Spalte, Zeile, Beschreibung)
|
||||||
# gibt an wo der Raumname auf dem Bildschirm angezeigt wird
|
# gibt an wo der Raumname auf dem Bildschirm angezeigt wird
|
||||||
self.room_decription = [
|
self.room_decription = [
|
||||||
(8, 3, "Room 102"),
|
(7, 13, "Room 102"),
|
||||||
(27, 3, "Room 103"),
|
(32, 13, "Room 103"),
|
||||||
(43, 3, "Room 105")
|
(49, 13, "Room 105")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -73,7 +78,7 @@ class Map:
|
|||||||
"R": color_room,
|
"R": color_room,
|
||||||
"H": color_hall,
|
"H": color_hall,
|
||||||
"D": color_door,
|
"D": color_door,
|
||||||
"S": color_hall,
|
"S": color_start,
|
||||||
}
|
}
|
||||||
|
|
||||||
# äußere Schleife Zeile für Zeile
|
# äußere Schleife Zeile für Zeile
|
||||||
@@ -108,8 +113,8 @@ class Map:
|
|||||||
column, row, text = self.room_decription[i]
|
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
|
# 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
|
px = column * tile_size - cam_x + 2
|
||||||
py = row + tile_size - cam_y + 2
|
py = row * tile_size - cam_y + 2
|
||||||
|
|
||||||
# Text-Bild mit fon.render()
|
# Text-Bild mit fon.render()
|
||||||
# True gibt eine glattere Schrift
|
# True gibt eine glattere Schrift
|
||||||
@@ -121,7 +126,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
screen = pygame.display.set_mode((screen_w, screen_h))
|
screen = pygame.display.set_mode((screen_w, screen_h))
|
||||||
font = pygame.font.SysFont("monospace", 12, bold=True)
|
font = pygame.font.SysFont("monospace", 26, bold=True)
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
|
|
||||||
my_map = Map()
|
my_map = Map()
|
||||||
|
|||||||
Reference in New Issue
Block a user