Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
106 lines
12 KiB
Python
106 lines
12 KiB
Python
#!/usr/bin/env python3
|
|
"""Orbit Arcade: logo, games menu and an OrbitHive Bedlam play screen, as design proofs. Original artwork; nothing here is in the app.
|
|
Paul approved this game list on 2 November 2026: small games only, to keep the app small. Scores are placeholders."""
|
|
import math, random, subprocess
|
|
from pathlib import Path
|
|
HERE = Path(__file__).parent
|
|
DEFS = ('<defs><linearGradient id="silver" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFFFFF"/><stop offset=".44" stop-color="#E8EDF5"/><stop offset=".5" stop-color="#B7CBE8"/><stop offset="1" stop-color="#F5F7FF"/></linearGradient>'
|
|
'<linearGradient id="honey" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FFF1A8"/><stop offset=".5" stop-color="#FFD84A"/><stop offset="1" stop-color="#F2A516"/></linearGradient>'
|
|
'<linearGradient id="space" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#071632"/><stop offset=".6" stop-color="#0E1F52"/><stop offset="1" stop-color="#2A1760"/></linearGradient>'
|
|
'<radialGradient id="planet" cx=".35" cy=".3" r=".8"><stop offset="0" stop-color="#6C8CFF"/><stop offset=".6" stop-color="#3A3FA8"/><stop offset="1" stop-color="#1A1650"/></radialGradient>'
|
|
'<radialGradient id="glass" cx=".35" cy=".3" r=".8"><stop offset="0" stop-color="#FFFFFF" stop-opacity=".55"/><stop offset="1" stop-color="#BFE3FF" stop-opacity=".12"/></radialGradient></defs>')
|
|
CRESCENT = 'M335 132C141 114 66 384 257 475C143 363 185 207 335 132Z'
|
|
RING = 'M129 369C102 399 111 425 161 428C267 432 431 340 445 289C455 250 405 250 369 261'
|
|
PIECES = ['#FF5A4F', '#3FC1FF', '#5BD46A', '#C77DFF', '#FF8A3D', '#FFD84A']
|
|
def mark(x, y, s, ring='#FFD84A'):
|
|
return f'<g transform="translate({x},{y}) scale({s})"><path d="{CRESCENT}" fill="url(#silver)"/><path d="{RING}" fill="none" stroke="{ring}" stroke-width="13"/><circle cx="430" cy="282" r="10" fill="{ring}"/></g>'
|
|
def text(x, y, v, size, fill, family='Barlow', extra=''):
|
|
return f'<text x="{x}" y="{y}" font-family="{family}" font-size="{size}" fill="{fill}" {extra}>{v}</text>'
|
|
def hexpath(cx, cy, r):
|
|
return 'M' + 'L'.join(f'{cx + r * math.sin(math.radians(60 * i)):.1f} {cy - r * math.cos(math.radians(60 * i)):.1f}' for i in range(6)) + 'Z'
|
|
def piece(cx, cy, r, colour):
|
|
return f'<path d="{hexpath(cx, cy, r)}" fill="{colour}"/><path d="{hexpath(cx, cy, r * .68)}" fill="#FFFFFF" fill-opacity=".2"/><path d="{hexpath(cx - r * .14, cy - r * .2, r * .24)}" fill="#FFFFFF" fill-opacity=".55"/>'
|
|
def stars(w, h, n=110, seed=4):
|
|
rnd = random.Random(seed)
|
|
return ''.join(f'<circle cx="{rnd.randrange(w)}" cy="{rnd.randrange(h)}" r="{rnd.choice((1, 1.5, 2, 3))}" fill="{rnd.choice(("#FFFFFF", "#FFFFFF", "#FFD84A", "#3FC1FF", "#FF8FD0"))}" fill-opacity="{rnd.uniform(.4, .95):.2f}"/>' for _ in range(n))
|
|
def comb(w, h, r=64):
|
|
out = ''
|
|
for j in range(int(h / (r * 1.5)) + 2):
|
|
for i in range(int(w / (r * 1.73)) + 2):
|
|
out += f'<path d="{hexpath(i * r * 1.732 + (j % 2) * r * .866, j * r * 1.5, r)}" fill="none" stroke="#7FB2FF" stroke-opacity=".07" stroke-width="2"/>'
|
|
return out
|
|
def bee(x, y, s):
|
|
"""The astronaut bee: a round body, a helmet you can see through, and small wings."""
|
|
return (f'<g transform="translate({x},{y}) scale({s})"><ellipse cx="-28" cy="-54" rx="26" ry="42" transform="rotate(-24 -28 -54)" fill="#CFE3FF" fill-opacity=".8"/><ellipse cx="14" cy="-58" rx="22" ry="36" transform="rotate(16 14 -58)" fill="#CFE3FF" fill-opacity=".6"/>'
|
|
'<ellipse cx="-30" cy="4" rx="64" ry="46" fill="url(#honey)"/><path d="M-64 -30C-72 -8 -72 18 -62 34L-44 44C-54 14 -54 -14 -44 -42ZM-22 -46C-32 -14 -32 22 -22 50L-2 46C-12 16 -12 -14 -4 -44Z" fill="#071632"/>'
|
|
'<circle cx="46" cy="-8" r="34" fill="#FFD84A"/><circle cx="56" cy="-14" r="7" fill="#071632"/><path d="M50 8C58 13 66 12 72 6" fill="none" stroke="#071632" stroke-width="4" stroke-linecap="round"/>'
|
|
'<circle cx="46" cy="-8" r="46" fill="url(#glass)" stroke="#E8EDF5" stroke-width="5"/><path d="M34 -52L26 -80M58 -52L68 -80" stroke="#E8EDF5" stroke-width="4"/><circle cx="26" cy="-84" r="6" fill="#FF5A4F"/><circle cx="68" cy="-84" r="6" fill="#3FC1FF"/></g>')
|
|
def write(name, w, h, body):
|
|
src = HERE / f'{name}.svg'
|
|
src.write_text(f'<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}" viewBox="0 0 {w} {h}">{DEFS}{body}</svg>')
|
|
subprocess.run(['vectorcraft-cli', 'convert', str(src), str(HERE / f'{name}.png')], check=True, stdout=subprocess.DEVNULL)
|
|
|
|
# The logo.
|
|
write('arcade_logo', 1024, 360, '<rect width="1024" height="360" fill="#071632"/>' + stars(1024, 360, 45) + mark(30, 20, .58) + text(366, 108, 'ORBIT', 44, '#F5F7FF', 'Barlow', 'font-weight="600" letter-spacing="16"') +
|
|
text(362, 262, 'ARCADE', 150, 'url(#honey)', 'Anton', 'letter-spacing="4"') + ''.join(piece(378 + i * 62, 306, 26, c) for i, c in enumerate(PIECES[:5])) + bee(858, 306, .52))
|
|
|
|
# The app's copy has no background, so it sits on whatever's behind it.
|
|
write('arcade_logo_clear', 1024, 360, mark(30, 20, .58) + text(366, 108, 'ORBIT', 44, '#F5F7FF', 'Barlow', 'font-weight="600" letter-spacing="16"') +
|
|
text(362, 262, 'ARCADE', 150, 'url(#honey)', 'Anton', 'letter-spacing="4"') + ''.join(piece(378 + i * 62, 306, 26, c) for i, c in enumerate(PIECES[:5])) + bee(858, 306, .52))
|
|
from PIL import Image
|
|
Image.open(HERE / 'arcade_logo_clear.png').convert('RGBA').resize((512, 180), Image.LANCZOS).save(HERE.parents[1] / 'android/app/src/main/res/drawable-nodpi/orbit_arcade_logo.webp', quality=92)
|
|
|
|
# Icons for the menu, drawn in a box 100 wide around 0,0.
|
|
def snake(c):
|
|
return f'<path d="M-40 26H-6V-8H30V-34" fill="none" stroke="{c}" stroke-width="13" stroke-linejoin="round" stroke-linecap="round"/><circle cx="30" cy="-36" r="9" fill="{c}"/><rect x="-40" y="-30" width="15" height="15" fill="#FF5A4F"/>'
|
|
def blocks(c):
|
|
return ''.join(f'<rect x="{x}" y="{y}" width="24" height="24" rx="3" fill="{k}"/>' for x, y, k in [(-38, 8, c), (-12, 8, c), (14, 8, c), (-12, -18, c), (-12, -44, '#3FC1FF')])
|
|
def bricks(c):
|
|
return ''.join(f'<rect x="{-42 + i * 29}" y="{-40 + j * 16}" width="26" height="13" fill="{k}"/>' for j, k in enumerate(('#FF5A4F', c)) for i in range(3)) + f'<circle cx="6" cy="6" r="7" fill="{c}"/><rect x="-22" y="26" width="44" height="9" rx="4" fill="{c}"/>'
|
|
def pairs(c):
|
|
return f'<rect x="-40" y="-34" width="38" height="62" rx="5" fill="none" stroke="{c}" stroke-width="5"/><rect x="4" y="-34" width="38" height="62" rx="5" fill="{c}"/><path d="{hexpath(-21, -3, 11)}" fill="#3FC1FF"/><path d="{hexpath(23, -3, 11)}" fill="#071632"/>'
|
|
def cards(c):
|
|
return f'<rect x="-30" y="-30" width="44" height="62" rx="5" transform="rotate(-14)" fill="none" stroke="{c}" stroke-width="5"/><rect x="-14" y="-36" width="44" height="62" rx="5" transform="rotate(8)" fill="{c}"/><path d="M8 -20L20 -4L8 12L-4 -4Z" fill="#FF5A4F"/>'
|
|
def hive(c):
|
|
return piece(-20, 8, 22, '#3FC1FF') + piece(20, 8, 22, '#FF5A4F') + piece(0, -26, 22, c)
|
|
GAMES = [('OrbitHive', 'Bedlam', hive, True), ('Snake', '', snake, False), ('Block Drop', '', blocks, False), ('Brick Break', '', bricks, False), ('Pairs', '', pairs, False), ('Patience', '', cards, False)]
|
|
|
|
# The menu: a featured game on the left, the rest as a honeycomb, focus in yellow as everywhere else.
|
|
R = 124
|
|
cells = [(1252, 318), (1486, 318), (1720, 318), (1369, 524), (1603, 524), (1252, 730), (1486, 730), (1720, 730)]
|
|
tiles = ''
|
|
for i, (cx, cy) in enumerate(cells):
|
|
if i >= len(GAMES):
|
|
tiles += f'<path d="{hexpath(cx, cy, R)}" fill="none" stroke="#7FB2FF" stroke-opacity=".35" stroke-width="3" stroke-dasharray="10 9"/>' + text(cx, cy + 9, 'More soon', 25, '#AEBBD2', 'Barlow', 'text-anchor="middle"')
|
|
continue
|
|
top, sub, icon, on = GAMES[i]
|
|
ink = '#071632' if on else '#F5F7FF'
|
|
tiles += f'<path d="{hexpath(cx, cy, R)}" fill="{"#FFD23F" if on else "#12356B"}"/><g transform="translate({cx},{cy - 26}) scale(.86)">{icon("#071632" if on else "#F5F7FF")}</g>'
|
|
tiles += text(cx, cy + 56, top, 28, ink, 'Barlow', 'font-weight="600" text-anchor="middle"')
|
|
if sub: tiles += text(cx, cy + 88, sub, 28, ink, 'Barlow', 'font-weight="600" text-anchor="middle"')
|
|
rnd = random.Random(9)
|
|
arena = ''
|
|
for j in range(5):
|
|
for i in range(9 - (j % 2)):
|
|
if (j == 4 and i % 3 == 1): continue
|
|
arena += piece(150 + i * 92 + (j % 2) * 46, 300 + j * 80, 50, rnd.choice(PIECES))
|
|
write('arcade_menu', 1920, 1080, '<rect width="1920" height="1080" fill="url(#space)"/>' + comb(1920, 1080) + stars(1920, 1080) + mark(30, 24, .23) + text(176, 76, 'ORBIT', 25, '#F5F7FF', 'Barlow', 'font-weight="600" letter-spacing="9"') + text(174, 130, 'ARCADE', 56, 'url(#honey)', 'Anton', 'letter-spacing="2"') +
|
|
'<clipPath id="feature"><rect x="48" y="176" width="1044" height="730" rx="10"/></clipPath><g clip-path="url(#feature)"><rect x="48" y="176" width="1044" height="730" fill="#050E2A"/>' + stars(1100, 900, 70, 11) + '<circle cx="1040" cy="770" r="180" fill="url(#planet)"/><ellipse cx="1040" cy="770" rx="256" ry="52" transform="rotate(-14 1040 770)" fill="none" stroke="#FFD84A" stroke-width="5"/>' + arena + bee(190, 760, 1.2) + '</g>' +
|
|
'<rect x="48" y="176" width="1044" height="730" rx="10" fill="none" stroke="#7FB2FF" stroke-opacity=".4" stroke-width="2"/>' + text(380, 742, 'ORBITHIVE', 30, '#F5F7FF', 'Barlow', 'font-weight="600" letter-spacing="10"') + text(376, 842, 'BEDLAM', 104, 'url(#honey)', 'Anton', 'letter-spacing="3"') +
|
|
tiles + text(48, 978, 'Best score', 26, '#AEBBD2') + text(190, 978, '48,200', 30, '#FFFFFF', 'Barlow', 'font-weight="600"') + text(320, 978, 'Wave 12', 26, '#AEBBD2') + text(48, 1038, 'OK Play', 26, '#AEBBD2') + text(190, 1038, '◄►▲▼ Choose a game', 26, '#AEBBD2') + text(480, 1038, 'Back Leave the arcade', 26, '#AEBBD2'))
|
|
|
|
# The game: original rules still to design, shown here as a hive you fire pieces into.
|
|
rnd = random.Random(21)
|
|
hive_pieces = ''
|
|
for j in range(7):
|
|
for i in range(11 - (j % 2)):
|
|
if j >= 4 and rnd.random() < .22 * (j - 2): continue
|
|
hive_pieces += piece(506 + i * 90 + (j % 2) * 45, 120 + j * 78, 48, rnd.choice(PIECES))
|
|
aim = ''.join(f'<circle cx="{960 + k * 30}" cy="{880 - k * 60}" r="6" fill="#FFFFFF" fill-opacity="{.9 - k * .1:.1f}"/>' for k in range(1, 7))
|
|
write('arcade_bedlam', 1920, 1080, '<rect width="1920" height="1080" fill="url(#space)"/>' + stars(1920, 1080, 130) + '<circle cx="1760" cy="950" r="165" fill="url(#planet)"/><ellipse cx="1760" cy="950" rx="236" ry="48" transform="rotate(-14 1760 950)" fill="none" stroke="#FFD84A" stroke-width="5"/>' +
|
|
'<rect x="440" y="48" width="1040" height="984" rx="28" fill="#050E2A" fill-opacity=".72" stroke="#7FB2FF" stroke-opacity=".5" stroke-width="3"/>' + hive_pieces + aim + piece(960, 930, 58, '#3FC1FF') + '<path d="M820 972H1100" stroke="#FFD84A" stroke-width="6" stroke-linecap="round"/>' +
|
|
mark(40, 34, .2) + text(160, 72, 'ORBITHIVE', 22, '#F5F7FF', 'Barlow', 'font-weight="600" letter-spacing="7"') + text(158, 134, 'BEDLAM', 62, 'url(#honey)', 'Anton', 'letter-spacing="2"') +
|
|
text(60, 250, 'SCORE', 26, '#AEBBD2', 'Barlow', 'font-weight="600" letter-spacing="4"') + text(60, 320, '12,450', 68, '#FFFFFF', 'Anton') + text(60, 410, 'WAVE', 26, '#AEBBD2', 'Barlow', 'font-weight="600" letter-spacing="4"') + text(60, 480, '7', 68, '#FFFFFF', 'Anton') + bee(210, 760, 1.5) +
|
|
text(1540, 250, 'NEXT', 26, '#AEBBD2', 'Barlow', 'font-weight="600" letter-spacing="4"') + piece(1590, 320, 48, '#FF5A4F') + text(1540, 450, 'BEST', 26, '#AEBBD2', 'Barlow', 'font-weight="600" letter-spacing="4"') + text(1540, 520, '48,200', 56, '#FFFFFF', 'Anton') +
|
|
text(1540, 640, '◄► Aim', 26, '#AEBBD2') + text(1540, 682, 'OK Fire', 26, '#AEBBD2') + text(1540, 724, 'Back Pause', 26, '#AEBBD2'))
|