Mercurial > scrounge
changeset 14:2fee7a784843
remove unused generator
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sun, 21 Aug 2011 20:53:33 +0200 |
| parents | 028bb963b92b |
| children | ba21d882480c |
| files | generator.py level.py thing.py wall.png |
| diffstat | 4 files changed, 45 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/generator.py Sun Aug 21 20:09:43 2011 +0200 +++ b/generator.py Sun Aug 21 20:53:33 2011 +0200 @@ -13,13 +13,14 @@ for y in range(3)] for line in self.rooms: for x1, y1, x2, y2 in line: - self.rect(x1, y1, x2, y2, 'X', '.') + self.rect(x1, y1, x2, y2, 'X', '.+:') self.make_connections() for line in self.map: for i, c in enumerate(line): if c == 'X': line[i] = 'x' self.make_stairs() + self.make_trash() def _random_place(self): r1 = random.choice(random.choice(self.rooms)) @@ -27,6 +28,10 @@ y1 = random.randint(r1[1] + 1, r1[3] - 1) return x1, y1 + def make_trash(self): + for i in range(25): + self.things.append(thing.Plant(*self._random_place())) + def make_stairs(self): x1, y1 = self._random_place() self.things.append(thing.Entrance(x1, y1)) @@ -70,15 +75,15 @@ y2 = r2[1] m = random.randint(y1 + 1, y2 - 1) for y in range(y1, m): - self.map[y][x1] = ',' + self.map[y][x1] = random.choice(',;') if x1 < x2: for x in range(x1, x2 + 1): - self.map[m][x] = ',' + self.map[m][x] = random.choice(';"') else: for x in range(x2, x1 + 1): - self.map[m][x] = ',' + self.map[m][x] = random.choice(';"') for y in range(m, y2): - self.map[y][x2] = ',' + self.map[y][x2] = random.choice(',;') else: # horizontal v = False @@ -89,18 +94,16 @@ x2 = r2[0] y2 = random.randint(r2[1] + 1, r2[3] - 1) m = random.randint(x1 + 1, x2 - 1) - self.map[y1][m] = '+' - self.map[y2][m] = '+' for x in range(x1, m): - self.map[y1][x] = ',' + self.map[y1][x] = random.choice(',;') if y1 < y2: for y in range(y1, y2 + 1): - self.map[y][m] = ',' + self.map[y][m] = random.choice(';"') else: for y in range(y2, y1 + 1): - self.map[y][m] = ',' + self.map[y][m] = random.choice(';"') for x in range(m, x2): - self.map[y2][x] = ',' + self.map[y2][x] = random.choice(',;') self.map[y1][x1] = '+' self.map[y2][x2] = '+' if random.randint(0, 10) > 7: @@ -112,7 +115,7 @@ if fill: for y in range(y1 + 1, y2): for x in range(x1 + 1, x2): - self.map[y][x] = fill + self.map[y][x] = random.choice(fill) for y in range(y1, y2 + 1): self.map[y][x1] = c self.map[y][x2] = c
--- a/level.py Sun Aug 21 20:09:43 2011 +0200 +++ b/level.py Sun Aug 21 20:53:33 2011 +0200 @@ -10,7 +10,7 @@ class Tile(object): filename = 'wall.png' - tx, ty = 2, 3 + tx, ty = 0, 3 blocks = False def __init__(self, x, y, map): @@ -23,8 +23,24 @@ to_display.background.blit(tile, (self.x * 24, self.y * 16)) -class CorridorTile(Tile): - tx, ty = 0, 3 +class BrokenTile(Tile): + tx, ty = 2, 3 + + +class GroundTile(Tile): + tx, ty = 0, 4 + + +class PlantsTile(Tile): + tx, ty = 1, 4 + + +class WeedTile(Tile): + tx, ty = 2, 4 + + +class GrassTile(Tile): + tx, ty = 3, 4 class DoorTile(Tile): @@ -71,9 +87,13 @@ key = { '.': Tile, '+': DoorTile, - ',': CorridorTile, + ':': BrokenTile, '>': StairsTile, 'x': WallTile, + ',': GroundTile, + ';': PlantsTile, + '"': WeedTile, + '*': GrassTile, } BLOCKED = 1
