Refactoring: Project structure, sprite stairs & fog masks rendering fix
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
import sys
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
PALETTE = [
|
||||
224, 248, 207, # 0
|
||||
134, 192, 108, # 1
|
||||
48, 104, 80, # 2
|
||||
7, 24, 33 # 3
|
||||
] + [0] * (256 * 3 - 12)
|
||||
|
||||
def generate_victory():
|
||||
# 64x16 pixels
|
||||
img = Image.new("P", (64, 16), 3)
|
||||
img.putpalette(PALETTE)
|
||||
|
||||
grids = {
|
||||
'V': [
|
||||
"32233223",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"33200233",
|
||||
"33322333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333"
|
||||
],
|
||||
'I': [
|
||||
"33322333",
|
||||
"33322333",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33322333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333"
|
||||
],
|
||||
'T': [
|
||||
"32222223",
|
||||
"32000002",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33300333",
|
||||
"33322333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333"
|
||||
],
|
||||
'O': [
|
||||
"33222233",
|
||||
"32000023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32000023",
|
||||
"33222233",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333"
|
||||
],
|
||||
'R': [
|
||||
"32222233",
|
||||
"32000023",
|
||||
"32022023",
|
||||
"32000233",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32233223",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333"
|
||||
],
|
||||
'A': [
|
||||
"33322333",
|
||||
"33200233",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32000023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32022023",
|
||||
"32233223",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333",
|
||||
"33333333"
|
||||
]
|
||||
}
|
||||
|
||||
text = "VITTORIA"
|
||||
for i, char in enumerate(text):
|
||||
grid = grids[char]
|
||||
for y in range(16):
|
||||
for x in range(8):
|
||||
val = int(grid[y][x])
|
||||
target_x = i * 8 + x
|
||||
target_y = y
|
||||
if target_x < 64 and target_y < 16:
|
||||
img.putpixel((target_x, target_y), val)
|
||||
|
||||
img.save("victory.png")
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_victory()
|
||||
Reference in New Issue
Block a user