Commit 19/03-24
Fixed issue with terrain height level (y level on the x-y coordinate system) not properly being assigned and creating double-layers. Also fixed problem with "null terrain" being created and turned into a biome. Added biome balance to help regulate amount of each biome spawning.
This commit is contained in:
parent
808e806b6a
commit
cbc07fdf16
19 changed files with 462 additions and 30 deletions
|
|
@ -81,9 +81,10 @@ class MapManager:
|
|||
currentHorizontal = 0
|
||||
currentTile = 0
|
||||
for y in range(0, mapObject.get_height()-1):
|
||||
if (y-1) % 10 == 0:
|
||||
if (y-1) % 5 == 0:
|
||||
currentVertical += 1
|
||||
currentHorizontal = 0
|
||||
print(f"Current Vertical:{currentVertical}")
|
||||
for x in range(0, mapObject.get_width()-1):
|
||||
CurCol = mapObject.get_at((x, y))
|
||||
if CurCol == (255,255,255,255):
|
||||
|
|
@ -94,15 +95,15 @@ class MapManager:
|
|||
if tileprint < 20:
|
||||
print(f"Added tiles: {goodtiles}")
|
||||
tileprint += 1
|
||||
colour1 = 255
|
||||
colour2 = 0
|
||||
colour1 = 0
|
||||
colour2 = 255
|
||||
colour3 = 0
|
||||
self.tiles[f"{currentTile}"].paint_pixels(mapObject, int(colour1),int(colour2),int(colour3))
|
||||
currentTile += 1
|
||||
currentHorizontal += 1
|
||||
self.amountOfTiles = currentTile
|
||||
self.Verticals = 59
|
||||
self.Horizontals = 207
|
||||
self.Verticals = 200
|
||||
self.Horizontals = 200
|
||||
print(f"{self.tiles.keys()}")
|
||||
|
||||
def populate(self, mapObject):
|
||||
|
|
@ -120,22 +121,36 @@ class MapManager:
|
|||
if choice != 6 and position[0] != 0:
|
||||
tilesMapped[position[0]][position[1]] = tilesMapped[position[0]-1][position[1]]
|
||||
else:
|
||||
tilesMapped[position[0]][position[1]] = self.TileWorker.get_rand_tType()
|
||||
else:
|
||||
choice = random.randrange(1,12)
|
||||
if choice <= 5:
|
||||
tilesMapped[position[0]][position[1]] = self.TileWorker.get_rand_tType(tilesMapped, position)
|
||||
elif position [0] == 0:
|
||||
choice = random.randrange(1,7)
|
||||
if choice != 6 and position[1] != 0:
|
||||
tilesMapped[position[0]][position[1]] = tilesMapped[position[0]][position[1]-1]
|
||||
elif choice != 11:
|
||||
else:
|
||||
tilesMapped[position[0]][position[1]] = self.TileWorker.get_rand_tType(tilesMapped, position)
|
||||
else:
|
||||
choice = random.randrange(1,21)
|
||||
if choice <= 6:
|
||||
tilesMapped[position[0]][position[1]] = tilesMapped[position[0]][position[1]-1]
|
||||
elif choice >= 7 and choice <= 14:
|
||||
tilesMapped[position[0]][position[1]] = tilesMapped[position[0]-1][position[1]]
|
||||
elif choice == 11:
|
||||
tilesMapped[position[0]][position[1]] = self.TileWorker.get_rand_tType()
|
||||
elif choice != 20:
|
||||
choice2 = random.randrange(1,3)
|
||||
if choice2 == 1:
|
||||
tilesMapped[position[0]][position[1]] = tilesMapped[position[0]][position[1]-1]
|
||||
else:
|
||||
if position[0] != int(mapObject.get_width()):
|
||||
tilesMapped[position[0]][position[1]] = tilesMapped[position[0]+1][position[1]-1]
|
||||
else:
|
||||
tilesMapped[position[0]][position[1]] = tilesMapped[position[0]-1][position[1]-1]
|
||||
elif choice == 20:
|
||||
tilesMapped[position[0]][position[1]] = self.TileWorker.get_rand_tType(tilesMapped, position)
|
||||
print(f"{tilesMapped}")
|
||||
mappedColours = self.TileWorker.get_terrain("colours")
|
||||
for x in self.tiles.keys():
|
||||
tile = self.tiles[f"{x}"]
|
||||
if tilesMapped[tile.Position[0]][tile.Position[1]] != "":
|
||||
colour = mappedColours[f"{tilesMapped[tile.Position[0]][tile.Position[1]]}"]
|
||||
print(f"{colour}")
|
||||
colour1, colour2, colour3 = colour[0], colour[1], colour[2]
|
||||
tile.paint_pixels(mapObject, int(colour1),int(colour2),int(colour3))
|
||||
|
||||
|
|
@ -145,7 +160,6 @@ class Tile:
|
|||
def __init__(self, Id, Pos):
|
||||
self.Id = Id
|
||||
self.Position = Pos
|
||||
print(f"{Pos[0]},{Pos[1]}")
|
||||
self.pixels = []
|
||||
self.colour = (random.randint(0,255),random.randint(0,255),random.randint(0,255))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue