1
Fork 0
mirror of https://github.com/Steffo99/flyingsnake.git synced 2024-12-23 06:54:19 +00:00

Update __main__.py

This commit is contained in:
Garvita Jain 2019-09-29 02:00:38 +05:30 committed by GitHub
parent 02f7476f46
commit 51c03c76d8
Signed by: github
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,14 +117,14 @@ def flyingsnake(input_file: str,
walls = Image.new("RGBA", (world.size.x, world.size.y)) walls = Image.new("RGBA", (world.size.x, world.size.y))
draw = ImageDraw.Draw(walls) draw = ImageDraw.Draw(walls)
with c.progressbar(world.tiles, length = world.size) as bar: with c.progressbar(world.tiles, length = world.size) as bar:
for tile in bar: for x in range(world.size.x):
if tile.wall: for y in range(world.size.y):
if draw_paint and tile.wall.paint: if tile.wall:
color = tuple(colors["Paints"][str(tile.wall.paint)]) if draw_paint and tile.wall.paint:
else: color = tuple(colors["Paints"][str(tile.wall.paint)])
color = tuple(colors["Walls"][str(tile.wall.type.value)]) else:
draw.point((x, y), color) color = tuple(colors["Walls"][str(tile.wall.type.value)])
draw.point((x, y), color)
del draw del draw
to_merge.append(walls) to_merge.append(walls)
@ -133,15 +133,15 @@ def flyingsnake(input_file: str,
liquids = Image.new("RGBA", (world.size.x, world.size.y)) liquids = Image.new("RGBA", (world.size.x, world.size.y))
draw = ImageDraw.Draw(liquids) draw = ImageDraw.Draw(liquids)
with c.progressbar(world.tiles, length = world.size) as bar: with c.progressbar(world.tiles, length = world.size) as bar:
for tile in bar: for x in range(world.size.x):
if tile.liquid: for y in range(world.size.y):
if tile.liquid.type == li.tiles.LiquidType.WATER: if tile.liquid:
draw.point((x, y), tuple(colors["Globals"]["Water"])) if tile.liquid.type == li.tiles.LiquidType.WATER:
elif tile.liquid.type == li.tiles.LiquidType.LAVA: draw.point((x, y), tuple(colors["Globals"]["Water"]))
draw.point((x, y), tuple(colors["Globals"]["Lava"])) elif tile.liquid.type == li.tiles.LiquidType.LAVA:
elif tile.liquid.type == li.tiles.LiquidType.HONEY: draw.point((x, y), tuple(colors["Globals"]["Lava"]))
draw.point((x, y), tuple(colors["Globals"]["Honey"])) elif tile.liquid.type == li.tiles.LiquidType.HONEY:
draw.point((x, y), tuple(colors["Globals"]["Honey"]))
del draw del draw
to_merge.append(liquids) to_merge.append(liquids)
@ -150,15 +150,14 @@ def flyingsnake(input_file: str,
blocks = Image.new("RGBA", (world.size.x, world.size.y)) blocks = Image.new("RGBA", (world.size.x, world.size.y))
draw = ImageDraw.Draw(blocks) draw = ImageDraw.Draw(blocks)
with c.progressbar(world.tiles, length = world.size) as bar: with c.progressbar(world.tiles, length = world.size) as bar:
for tile in bar: for x in range(world.size.x):
if tile.block: for y in range(world.size.y):
if draw_paint and tile.block.paint: if tile.block:
color = tuple(colors["Paints"][str(tile.block.paint)]) if draw_paint and tile.block.paint:
else: color = tuple(colors["Paints"][str(tile.block.paint)])
color = tuple(colors["Blocks"][str(tile.block.type.value)]) else:
draw.point((x, y), color) color = tuple(colors["Blocks"][str(tile.block.type.value)])
draw.point((x, y), color)
del draw del draw
to_merge.append(blocks) to_merge.append(blocks)
@ -167,17 +166,17 @@ def flyingsnake(input_file: str,
wires = Image.new("RGBA", (world.size.x, world.size.y)) wires = Image.new("RGBA", (world.size.x, world.size.y))
draw = ImageDraw.Draw(wires) draw = ImageDraw.Draw(wires)
with c.progressbar(world.tiles, length = world.size) as bar: with c.progressbar(world.tiles, length = world.size) as bar:
for tile in bar: for x in range(world.size.x):
if tile.wiring: for y in range(world.size.y):
if tile.wiring.red: if tile.wiring:
draw.point((x, y), tuple(colors["Globals"]["Wire"])) if tile.wiring.red:
if tile.wiring.blue: draw.point((x, y), tuple(colors["Globals"]["Wire"]))
draw.point((x, y), tuple(colors["Globals"]["Wire1"])) if tile.wiring.blue:
if tile.wiring.green: draw.point((x, y), tuple(colors["Globals"]["Wire1"]))
draw.point((x, y), tuple(colors["Globals"]["Wire2"])) if tile.wiring.green:
if tile.wiring.yellow: draw.point((x, y), tuple(colors["Globals"]["Wire2"]))
draw.point((x, y), tuple(colors["Globals"]["Wire3"])) if tile.wiring.yellow:
draw.point((x, y), tuple(colors["Globals"]["Wire3"]))
del draw del draw
to_merge.append(wires) to_merge.append(wires)