Refactoring: Project structure, sprite stairs & fog masks rendering fix
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import os
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
# Standard Game Boy palette
|
||||
# 0: White, 1: Light Gray, 2: Dark Gray, 3: Black
|
||||
PALETTE = [
|
||||
224, 248, 207, # 0
|
||||
134, 192, 108, # 1
|
||||
48, 104, 80, # 2
|
||||
7, 24, 33 # 3
|
||||
] + [0] * (256 * 3 - 12)
|
||||
|
||||
stairs_pattern = [
|
||||
"00000000000000033000000000000000",
|
||||
"00000000000003311330000000000000",
|
||||
"00000000000331111113300000000000",
|
||||
"00000000000003311330000000000000",
|
||||
"00000000000000033000000000000000",
|
||||
"00000000000003300330000000000000",
|
||||
"00000000000330000003300000000000",
|
||||
"00000000000003300330000000000000",
|
||||
"00000000000000033000000000000000",
|
||||
"00000000000003311330000000000000",
|
||||
"00000000000331111113300000000000",
|
||||
"00000000000003311330000000000000",
|
||||
"00000000000000033000000000000000",
|
||||
"00000000000003300330000000000000",
|
||||
"00000000000330000003300000000000",
|
||||
"00000000000003300330000000000000",
|
||||
]
|
||||
|
||||
def generate_stairs_sprite():
|
||||
img = Image.new("P", (32, 16), 0)
|
||||
img.putpalette(PALETTE)
|
||||
|
||||
for py in range(16):
|
||||
for px in range(32):
|
||||
char = stairs_pattern[py][px]
|
||||
if char != '0':
|
||||
img.putpixel((px, py), int(char))
|
||||
|
||||
img.save("stairs_sprite.png")
|
||||
print("stairs_sprite.png generated.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_stairs_sprite()
|
||||
Reference in New Issue
Block a user