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-28 23:50:29 +05:30 committed by GitHub
parent 51f31013dc
commit a910c09361
Signed by: github
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,9 +117,7 @@ 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 click.progressbar(world.tiles, length = world.size) as bar: with click.progressbar(world.tiles, length = world.size) as bar:
for x in range(world.size.x): for tile in bar:
for y in range(world.size.y):
tile = bar[x, y]
if tile.wall: if tile.wall:
if draw_paint and tile.wall.paint: if draw_paint and tile.wall.paint:
color = tuple(colors["Paints"][str(tile.wall.paint)]) color = tuple(colors["Paints"][str(tile.wall.paint)])
@ -135,9 +133,7 @@ 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 click.progressbar(world.tiles, length = world.size) as bar: with click.progressbar(world.tiles, length = world.size) as bar:
for x in range(world.size.x): for tile in bar:
for y in range(world.size.y):
tile = bar[x, y]
if tile.liquid: if tile.liquid:
if tile.liquid.type == li.tiles.LiquidType.WATER: if tile.liquid.type == li.tiles.LiquidType.WATER:
draw.point((x, y), tuple(colors["Globals"]["Water"])) draw.point((x, y), tuple(colors["Globals"]["Water"]))
@ -154,9 +150,7 @@ 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 click.progressbar(world.tiles, length = world.size) as bar: with click.progressbar(world.tiles, length = world.size) as bar:
for x in range(world.size.x): for tile in bar:
for y in range(world.size.y):
tile = bar[x, y]
if tile.block: if tile.block:
if draw_paint and tile.block.paint: if draw_paint and tile.block.paint:
color = tuple(colors["Paints"][str(tile.block.paint)]) color = tuple(colors["Paints"][str(tile.block.paint)])
@ -164,6 +158,7 @@ def flyingsnake(input_file: str,
color = tuple(colors["Blocks"][str(tile.block.type.value)]) color = tuple(colors["Blocks"][str(tile.block.type.value)])
draw.point((x, y), color) draw.point((x, y), color)
del draw del draw
to_merge.append(blocks) to_merge.append(blocks)
@ -172,9 +167,7 @@ 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 x in range(world.size.x): for tile in bar:
for y in range(world.size.y):
tile = bar[x, y]
if tile.wiring: if tile.wiring:
if tile.wiring.red: if tile.wiring.red:
draw.point((x, y), tuple(colors["Globals"]["Wire"])) draw.point((x, y), tuple(colors["Globals"]["Wire"]))