Merge remote-tracking branch 'origin/NewMovement' into NewMovementFinishing

This commit is contained in:
Michał Czekański 2020-04-26 00:18:37 +02:00
commit 2e6f2db543
3 changed files with 21 additions and 19 deletions

View File

@ -1,20 +1,20 @@
xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx
xssssssssssssssssssx xssssssssssssssssssx
xs................sx xsccc...c......cccsx
xs................sx xscccc..........ccsx
xs................sx xscc..............sx
xs................sx xscc........cc....sx
xs.....wwwwww.....sx xs.....wwwwwwc....sx
xs.....w,,,,w.....sx xs.....w,,,,w.....sx
xs.....w,,,,w.....sx xs.....w,,,,w.....sx
xs.....ww,,ww.....sx xs.....ww,,ww...ccsx
xs................sx xs...............csx
xs................sx xs...c............sx
xs................sx xs...........c....sx
xs................sx
xs................sx
xs................sx
xs................sx xs................sx
xs................sx xs................sx
xs.....c......c...sx
xs....cc.........csx
xs.............cccsx
xssssssssssssssssssx xssssssssssssssssssx
xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx

View File

@ -75,17 +75,19 @@ class Map:
for row, tiles in enumerate(self.terrain): for row, tiles in enumerate(self.terrain):
for col, tile in enumerate(tiles): for col, tile in enumerate(tiles):
if tile == 's': if tile == 's':
self.screen.draw(TerrainTile(col, row, 'sand.png', self.tileSize), Locations.MAP, 0, 0) self.screen.draw(TerrainTile(col, row, 'sand.png', self.tileSize, 15), Locations.MAP, 0, 0)
elif tile == ',': elif tile == ',':
self.screen.draw(TerrainTile(col, row, 'floor.png', self.tileSize), Locations.MAP, 0, 0) self.screen.draw(TerrainTile(col, row, 'floor.png', self.tileSize, 0), Locations.MAP, 0, 0)
elif tile == '.': elif tile == '.':
self.screen.draw(TerrainTile(col, row, 'grass.png', self.tileSize), Locations.MAP, 0, 0) self.screen.draw(TerrainTile(col, row, 'grass.png', self.tileSize, 10), Locations.MAP, 0, 0)
elif tile == 'c':
self.screen.draw(TerrainTile(col, row, 'clay.png', self.tileSize, 20), Locations.MAP, 0, 0)
elif tile == 'x': elif tile == 'x':
object = TerrainTile(col, row, 'water.png', self.tileSize) object = TerrainTile(col, row, 'water.png', self.tileSize, 0)
self.screen.draw(object, Locations.MAP, 0, 0) self.screen.draw(object, Locations.MAP, 0, 0)
self.collidables.add(object) self.collidables.add(object)
elif tile == 'w': elif tile == 'w':
object = TerrainTile(col, row, 'wall.png', self.tileSize) object = TerrainTile(col, row, 'wall.png', self.tileSize, 0)
self.screen.draw(object, Locations.MAP, 0, 0) self.screen.draw(object, Locations.MAP, 0, 0)
self.collidables.add(object) self.collidables.add(object)

View File

@ -4,7 +4,7 @@ import pygame
class TerrainTile(pygame.sprite.Sprite): class TerrainTile(pygame.sprite.Sprite):
def __init__(self, x, y, texture, tileSize): def __init__(self, x, y, texture, tileSize, cost):
super().__init__() super().__init__()
terrainTexturesPath = Path("./data/images/terrain").resolve() terrainTexturesPath = Path("./data/images/terrain").resolve()
self.image = pygame.image.load(str(terrainTexturesPath / texture)).convert() self.image = pygame.image.load(str(terrainTexturesPath / texture)).convert()
@ -14,5 +14,5 @@ class TerrainTile(pygame.sprite.Sprite):
self.y = y self.y = y
self.rect.x = x * tileSize self.rect.x = x * tileSize
self.rect.y = y * tileSize self.rect.y = y * tileSize
self.cost = cost
# TODO : rozne koszty map tilesów