Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
"""Pictures drawn for the port, in the game's own colours, where the editor's resources (tools/fetch.py) have none:
Isaac turning and walking (the resources show him only from the front), the HUD's hearts and counters, the map's
room icons, and the doors. Drawn at the game's size (26 pixels a cell), then scaled down with the rest."""
from PIL import Image, ImageDraw
# Isaac's colours (from his picture): outline, skin, shade, deeper shade, white, tears
ISAAC = {"#": (8, 0, 0), "+": (227, 198, 197), "o": (207, 156, 155), "r": (185, 115, 113), "w": (255, 255, 255),
"b": (156, 200, 204), "B": (103, 151, 156), "x": (120, 70, 70)}
def art(rows, pal):
"""rows of characters -> RGBA, '.' transparent"""
h, w = len(rows), max(len(r) for r in rows)
im = Image.new("RGBA", (w, h), (0, 0, 0, 0))
for y, r in enumerate(rows):
for x, ch in enumerate(r):
if ch in pal:
c = pal[ch]
im.putpixel((x, y), tuple(c) + ((255,) if len(c) == 3 else ()))
return im
# Isaac's head, 28 x 24, from the front (his picture), and the ways it turns
HEAD_FRONT = [
"..........########..........",
"........############........",
"......####oooooooo####......",
".....###o++++++++++o###.....",
"....##o++++++++++++++o##....",
"...##o++++++++++++++++o##...",
"..##o++++++++++++++++++o##..",
"..##++++++++++++++++++++##..",
".##o++++++++++++++++++++o##.",
".##++++++++++++++++++++++##.",
"##o++++++++++++++++++++++o##",
"##o+o####o++++++++o####o+o##",
"##o+#ww###++++++++#ww###+o##",
"##oo#ww###++++++++#ww###oo##",
"##ro######++####++######or##",
".##o######+######+######o##.",
".##ro####o+#wwww#+o####or##.",
"..##obbbo++######++obbbo##..",
"..##rbbb++++++++++++bbbr##..",
"...##Bbb++++++++++++bbB##...",
"....##Bbo++++++++++obB##....",
".....###Bo++++++++oB###.....",
"......####roooooor####......",
".......##############.......",
]
# crying: his eyes screwed shut, his mouth wide
HEAD_FRONT_CRY = [
"..........########..........",
"........############........",
"......####oooooooo####......",
".....###o++++++++++o###.....",
"....##o++++++++++++++o##....",
"...##o++++++++++++++++o##...",
"..##o++++++++++++++++++o##..",
"..##++++++++++++++++++++##..",
".##o++++++++++++++++++++o##.",
".##++++++++++++++++++++++##.",
"##o++++++++++++++++++++++o##",
"##o+o++++o++++++++o++++o+o##",
"##o+##+++##++++++##+++##+o##",
"##oo+#####++++++++#####+oo##",
"##ro++++++++####++++++++or##",
".##o++++++######++++++++o##.",
".##ro+++++##xxxx##+++++or##.",
"..##obbbo+#xxxxxx#+obbbo##..",
"..##rbbb+++######+++bbbr##..",
"...##Bbb++++++++++++bbB##...",
"....##Bbo++++++++++obB##....",
".....###Bo++++++++oB###.....",
"......####roooooor####......",
".......##############.......",
]
# turned to his right: one eye, his mouth at the edge
HEAD_SIDE = [
"..........########..........",
"........############........",
"......####oooooooo####......",
".....###o++++++++++o###.....",
"....##o++++++++++++++o##....",
"...##o++++++++++++++++o##...",
"..##o++++++++++++++++++o##..",
"..##++++++++++++++++++++##..",
".##o++++++++++++++++++++o##.",
".##+++++++++++++++++++++o##.",
"##o+++++++++++++++o####o+##.",
"##o+++++++++++++++#ww###+o##",
"##o+++++++++++++++#ww###++##",
"##oo++++++++++++++######++##",
"##ro+++++++++++++o######++##",
".##o++++++++++++++o####o####",
".##ro+++++++++++++obbbo+##w#",
"..##o+++++++++++++rbbb+++###",
"..##r+++++++++++++Bbbb++##..",
"...##o++++++++++++Bbbo+##...",
"....##o+++++++++++oBb+##....",
".....###oo+++++++++oB##.....",
"......####roooooorr###......",
".......##############.......",
]
HEAD_SIDE_CRY = [
"..........########..........",
"........############........",
"......####oooooooo####......",
".....###o++++++++++o###.....",
"....##o++++++++++++++o##....",
"...##o++++++++++++++++o##...",
"..##o++++++++++++++++++o##..",
"..##++++++++++++++++++++##..",
".##o++++++++++++++++++++o##.",
".##+++++++++++++++++++++o##.",
"##o+++++++++++++++o++++o+##.",
"##o+++++++++++++++##+++##o##",
"##o++++++++++++++++#####++##",
"##oo++++++++++++++++++++++##",
"##ro+++++++++++++o+++++####.",
".##o++++++++++++++o+++#xxx#.",
".##ro+++++++++++++obbb#xxx#.",
"..##o+++++++++++++rbbb+####.",
"..##r+++++++++++++Bbbb++##..",
"...##o++++++++++++Bbbo+##...",
"....##o+++++++++++oBb+##....",
".....###oo+++++++++oB##.....",
"......####roooooorr###......",
".......##############.......",
]
# the back of his head
HEAD_BACK = [
"..........########..........",
"........############........",
"......####oooooooo####......",
".....###o++++++++++o###.....",
"....##o++++++++++++++o##....",
"...##o++++++++++++++++o##...",
"..##o++++++++++++++++++o##..",
"..##++++++++++++++++++++##..",
".##o++++++++++++++++++++o##.",
".##++++++++++++++++++++++##.",
"##o++++++++++++++++++++++o##",
"##o++++++++++++++++++++++o##",
"##o++++++++++++++++++++++o##",
"##oo++++++++++++++++++++oo##",
"##ro++++++++++++++++++++or##",
".##o++++++++++++++++++++o##.",
".##ro++++++++++++++++++or##.",
"..##oo++++++++++++++++oo##..",
"..##roo++++++++++++++oor##..",
"...##roo++++++++++++oor##...",
"....##rroo++++++++oorr##....",
".....###rrooooooooorr###....",
"......####rrrrrrrr####......",
".......##############.......",
]
# his body, 28 x 10 (its top row is under his chin), facing the screen or walking to the right
BODY_FRONT = [
".......##############.......",
"......##o+########+o##......",
".....##o++oooooooo++o##.....",
".....##o+#o++++++o#+o##.....",
".....##o+#++++++++#+o##.....",
"......####++o##o++####......",
".......###+++##o++###.......",
"........###++##o+###........",
".........##########.........",
"..........###..###..........",
]
BODY_FRONT_STEP = [
".......##############.......",
"......##o+########+o##......",
".....##o++oooooooo++o##.....",
".....##o+#o++++++o#+o##.....",
".....##o+#++++++++#+o##.....",
"......####++o##o++####......",
".......###+++##o++###.......",
"........###++#####..........",
".........######o+##.........",
"..........###.####..........",
]
BODY_SIDE = [
".........###########........",
".........##o+++++o##........",
"........##o+++++++o##.......",
"........##o++#++++o##.......",
"........##o++#+++++##.......",
".........###++o++###........",
"..........##++o++##.........",
"..........##+o+++##.........",
"..........#########.........",
"...........###.###..........",
]
BODY_SIDE_STEP1 = [
".........###########........",
".........##o+++++o##........",
"........##o+++++++o##.......",
"........##o++#++++o##.......",
"........##o++#+++++##.......",
".........###++o++###........",
"........###+o####++##.......",
".......##+o##..##++o##......",
".......#####....######......",
"............................",
]
BODY_SIDE_STEP2 = [
".........###########........",
".........##o+++++o##........",
"........##o+++++++o##.......",
"........##o++#++++o##.......",
"........##o++#+++++##.......",
".........###+o+++###........",
".........###++##+o###.......",
"........##++o####+o##.......",
"........######..#####.......",
"............................",
]
# arms up, holding what he found over his head
BODY_HOLD = [
"..##...##############...##..",
"..#+#.##o+########+o##.#+#..",
"..#+o##o++oooooooo++o##o+#..",
"...#o+#o++++++++++++o#+o#...",
"....##++++++++++++++++##....",
"......####++o##o++####......",
".......###+++##o++###.......",
"........###++##o+###........",
".........##########.........",
"..........###..###..........",
]
def isaac_frames():
"""head: front, front crying, side, side crying, back, back crying; body: front x 4, side x 4, holding"""
heads = [art(r, ISAAC) for r in (HEAD_FRONT, HEAD_FRONT_CRY, HEAD_SIDE, HEAD_SIDE_CRY, HEAD_BACK, HEAD_BACK)]
fs = art(BODY_FRONT_STEP, ISAAC)
bodies = [art(BODY_FRONT, ISAAC), fs, art(BODY_FRONT, ISAAC), fs.transpose(Image.FLIP_LEFT_RIGHT),
art(BODY_SIDE, ISAAC), art(BODY_SIDE_STEP1, ISAAC), art(BODY_SIDE, ISAAC), art(BODY_SIDE_STEP2, ISAAC),
art(BODY_HOLD, ISAAC)]
return heads, bodies
# ---------------------------------------------------------------- the HUD (drawn at the screen's size)
HEART = [
"..###.###..",
".#aaa#aaa#.",
"#aawaaaaaa#",
"#awaaaaaaa#",
"#aaaaaaaaa#",
".#aaaaaaa#.",
"..#aaaaa#..",
"...#aaa#...",
"....#a#....",
".....#.....",
]
HEARTS = {"red": (210, 30, 30), "soul": (110, 140, 205), "black": (40, 36, 44), "eternal": (250, 250, 250),
"empty": (40, 16, 16)}
def heart(kind, half=False):
"""a HUD heart: full, or its left half (the right one an empty container)"""
rows = [list(r) for r in HEART]
pal = {"#": (0, 0, 0), "a": HEARTS[kind], "w": (255, 255, 255) if kind != "eternal" else (200, 200, 220),
"e": HEARTS["empty"]}
if kind == "black":
pal["w"] = (100, 90, 110)
if half:
for r in rows:
for x in range(6, len(r)):
if r[x] in "aw":
r[x] = "e" if kind == "red" else "."
if kind != "red": # soul and black halves are the left half alone
for x in range(6, len(r)):
if r[x] == "#" and (x > 6 and "." in r[x - 1:x]):
r[x] = "."
if kind != "red":
rows = [r[:6] + ["#" if r[5] in "aw#" and ch != "." else "." for ch in r[6:7]] + ["."] * 4 for r in rows]
rows[0][6] = "."
return art(["".join(r) for r in rows], pal)
ICONS = {
# 9 x 9: a coin, a bomb, a key
"coin": ["..#####..", ".#yyyyy#.", "#yyYyyyy#", "#yYyy#yy#", "#yYy#yyy#", "#yyy#yyy#", "#yyyyyyy#",
".#yyyyy#.", "..#####.."],
"bomb": ["......#..", ".....#.y.", "..####...", ".#gggg#..", "#gwgggg#.", "#gwggggg#", "#gggggg#.",
".#gggg#..", "..####..."],
"key": ["..###....", ".#yyy#...", "#yy#yy#..", "#y#.#y#..", ".#yyy#...", "..#y#....", "..#yy#...",
"..#y#....", "..#yy#..."],
}
ICON_PAL = {"#": (20, 12, 8), "y": (250, 200, 60), "Y": (200, 140, 30), "g": (70, 70, 80), "w": (170, 170, 190)}
# the map's room icons, 7 x 7: a skull, a crown, a dollar, a question mark, a heart (curse), an arcade die...
MAP_ICONS = {
"boss": ["..###..", ".#####.", "#.#.#.#", "#######", ".#####.", ".#.#.#.", "......."],
"treasure": ["#..#..#", "##.#.##", "#######", "#######", ".#####.", ".......", "......."],
"shop": ["...#...", ".#####.", "#..#...", ".#####.", "...#..#", ".#####.", "...#..."],
"secret": [".####..", "#....#.", ".....#.", "...##..", "...#...", ".......", "...#..."],
"curse": ["#.....#", "##...##", ".#####.", ".#.#.#.", ".#####.", "..#.#..", "......."],
"arcade": ["#######", "#.....#", "#.#.#.#", "#.....#", "#.#.#.#", "#.....#", "#######"],
"sacrifice": ["...#...", "..###..", ".#####.", "#######", "...#...", "...#...", "...#..."],
"library": ["##.##..", "#.#.#..", "#.#.#..", "#.#.#..", "#.#.#..", "##.##..", "......."],
"miniboss": ["#.....#", "##...##", "#.###.#", "#######", ".#####.", "..#.#..", "......."],
"challenge": ["...#...", "..#.#..", "..#.#..", ".#####.", "...#...", "..###..", "......."],
"chest": ["..###..", ".#####.", "#######", "###.###", "#######", "#######", "......."],
}
def map_icon(name, colour):
return art(MAP_ICONS[name], {"#": colour})
def door(kind, open_):
"""a door in the top wall, at the game's size (the room's 26-pixel cells): 52 wide, 40 deep; the floor's
side is its bottom. The other three walls turn it."""
w, h = 52, 40
im = Image.new("RGBA", (w, h), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
frames = {"normal": ((92, 74, 66), (60, 46, 42), (130, 108, 96)),
"treasure": ((222, 170, 40), (150, 100, 20), (255, 230, 120)),
"boss": ((140, 20, 20), (70, 10, 10), (200, 60, 50)),
"secret": ((70, 60, 54), (40, 34, 30), (90, 80, 72)),
"shop": ((120, 90, 60), (70, 50, 30), (170, 130, 90)),
"curse": ((110, 20, 26), (50, 8, 10), (160, 40, 40)),
"devil": ((40, 10, 10), (20, 4, 4), (110, 20, 20)),
"angel": ((230, 230, 240), (170, 170, 190), (255, 255, 255)),
"arcade": ((200, 60, 140), (110, 30, 80), (250, 140, 200))}
face, dark, light = frames[kind]
if kind == "secret": # a hole blown in the wall
d.ellipse([10, 6, 42, 40], fill=(16, 10, 8, 255))
d.ellipse([14, 10, 38, 40], fill=(4, 2, 2, 255))
for x, y in ((8, 10), (40, 12), (12, 30), (38, 32), (26, 4)):
d.ellipse([x - 3, y - 2, x + 3, y + 2], fill=(60, 50, 44, 255))
return im
# the frame: an arch with its sides
d.polygon([(4, 0), (48, 0), (46, 38), (6, 38)], fill=dark + (255,))
d.polygon([(7, 2), (45, 2), (43, 36), (9, 36)], fill=face + (255,))
d.line([(8, 3), (44, 3)], fill=light + (255,), width=2)
# the opening
d.polygon([(14, 4), (38, 4), (37, 38), (15, 38)], fill=(8, 4, 4, 255))
if not open_: # two door halves, shut
leaf = (88, 64, 50) if kind not in ("treasure", "angel") else (200, 160, 60)
if kind == "boss":
leaf = (90, 24, 20)
d.rectangle([15, 8, 25, 37], fill=leaf + (255,))
d.rectangle([27, 8, 36, 37], fill=leaf + (255,))
d.line([(26, 8), (26, 37)], fill=(20, 10, 8, 255))
for y in (14, 24, 33):
d.line([(15, y), (36, y)], fill=(40, 26, 20, 255))
if kind == "boss": # its spikes and eyes
for x in (6, 14, 38, 46):
d.polygon([(x - 3, 0), (x + 3, 0), (x, -0 + 6)], fill=(230, 220, 200, 255))
d.ellipse([18, 0, 24, 5], fill=(255, 230, 120, 255))
d.ellipse([28, 0, 34, 5], fill=(255, 230, 120, 255))
if kind == "treasure":
d.polygon([(22, 0), (26, -0), (24, 4)], fill=(255, 250, 200, 255))
if kind == "curse":
for x in (8, 16, 36, 44):
d.polygon([(x - 3, 38), (x + 3, 38), (x, 30)], fill=(220, 210, 190, 255))
return im
def mom_foot():
"""Mom's foot, coming down from above: her leg, her foot and painted toenails (the game's size)"""
w, h = 72, 132
im = Image.new("RGBA", (w, h), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
skin, shade, dark, line = (232, 190, 176), (206, 156, 146), (170, 116, 108), (40, 16, 16)
d.rectangle([18, 0, 54, 92], fill=line + (255,))
d.rectangle([20, 0, 52, 92], fill=skin + (255,))
d.rectangle([42, 0, 52, 92], fill=shade + (255,))
d.ellipse([4, 74, 68, 128], fill=line + (255,))
d.ellipse([6, 76, 66, 126], fill=skin + (255,))
d.ellipse([40, 80, 64, 124], fill=shade + (255,))
for i, x in enumerate((8, 20, 32, 44, 55)):
r = 7 if i == 0 else 6 if i < 3 else 5
y = 114 - (2 if i in (1, 2) else 0)
d.ellipse([x - 1, y - 1, x + 2 * r + 1, y + 2 * r - 2], fill=line + (255,))
d.ellipse([x, y, x + 2 * r, y + 2 * r - 3], fill=skin + (255,))
d.ellipse([x + 2, y + r - 2, x + 2 * r - 2, y + 2 * r - 4], fill=(200, 30, 40, 255))
d.line([(36, 20), (36, 80)], fill=dark + (255,), width=1)
return im