Fertige Wand Renderung
This commit is contained in:
parent
64cb1fa862
commit
02622ce4b8
2 changed files with 3 additions and 2 deletions
2
game.py
2
game.py
|
|
@ -46,7 +46,7 @@ class Game:
|
||||||
Wall(
|
Wall(
|
||||||
self, TILE_SIZE, SCREEN_HEIGHT - TILE_SIZE, SCREEN_WIDTH//TILE_SIZE, 1
|
self, TILE_SIZE, SCREEN_HEIGHT - TILE_SIZE, SCREEN_WIDTH//TILE_SIZE, 1
|
||||||
),
|
),
|
||||||
Wall(self, SCREEN_WIDTH - TILE_SIZE, 0, SCREEN_WIDTH//TILE_SIZE, SCREEN_HEIGHT//TILE_SIZE),
|
Wall(self, SCREEN_WIDTH - TILE_SIZE, 0, 1, SCREEN_HEIGHT//TILE_SIZE),
|
||||||
Wall(self, 500, 500, 2, 2)
|
Wall(self, 500, 500, 2, 2)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class Wall:
|
||||||
for row in range(self.rows): # rows
|
for row in range(self.rows): # rows
|
||||||
current_row = []
|
current_row = []
|
||||||
for col in range(self.cols): # cols
|
for col in range(self.cols): # cols
|
||||||
current_row.append(pygame.Rect(col*TILE_SIZE, row*TILE_SIZE, TILE_SIZE, TILE_SIZE))
|
current_row.append(pygame.Rect(self.x+col*TILE_SIZE, self.y+row*TILE_SIZE, col*TILE_SIZE, row*TILE_SIZE))
|
||||||
|
|
||||||
self.grid.append(current_row)
|
self.grid.append(current_row)
|
||||||
|
|
||||||
|
|
@ -29,6 +29,7 @@ class Wall:
|
||||||
for row in self.grid:
|
for row in self.grid:
|
||||||
for wall_rect in row:
|
for wall_rect in row:
|
||||||
surface.blit(self.game.assets["wall"], wall_rect)
|
surface.blit(self.game.assets["wall"], wall_rect)
|
||||||
|
|
||||||
|
|
||||||
def get_rect(self) -> pygame.Rect:
|
def get_rect(self) -> pygame.Rect:
|
||||||
return self.rect
|
return self.rect
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue