βΆ Play it now in your browser β no install, works on desktop and mobile.
A complete, playable 2D pixel-art platformer for iOS, built with SpriteKit β and every sprite, animation, and tile is AI-generated via the PixelLab MCP. Run, jump, and stomp across endless, procedurally-generated levels that cycle through forest, snow, and desert biomes: ride moving platforms, grab crystals β each one dedicated to a real Agile Lens client β squash grumpy mushrooms, and topple King Grumpcap, a crowned, armored boss that caps every 5th level. Trigger fireworks by collecting every crystal (or by defeating the boss), chase your personal best, and post to an optional shared online high-score board β all to a chiptune soundtrack.
It's a showcase of the full asset β game pipeline: pixel art is generated on demand, dropped into the project, and wired into a physics-driven game with camera follow, parallax, particles, and a touch + keyboard control scheme.
Built by Alex Coulombe at Agile Lens.
| Engine | SpriteKit (SwiftUI SpriteView host) |
| Target | iOS 17+ Β· iPhone & iPad Β· landscape |
| Assets | PixelLab MCP (characters, animations, tileset) |
| Audio | Chiptune SFX + music, synthesized in pure Python |
| Web | HTML5/Canvas port β GitHub Pages, procedurally-generated levels |
| Gameplay | Moving platforms, a 3-hit boss every 5th level, 3 biomes, fireworks |
| Leaderboard | Personal best + optional shared online board (Cloudflare Worker + KV) |
| Project | Generated with XcodeGen |
- In a browser (anyone, no install): ibrews.github.io/crystal-caper β the full game runs in HTML5/Canvas, reusing the exact same AI-generated art. Desktop: arrow keys /
WASD+Space. Mobile: on-screen β βΆ JUMP. - On iOS (the original SpriteKit build): follow the Quickstart below.
- Global leaderboard: your personal best works out of the box; a shared online top-20 (web + iOS, one source of truth) lights up once the tiny Cloudflare Worker backend is deployed β one
wrangler deployplus setting the URL in each client (seeleaderboard/README.md).
# 1. Generate the Xcode project (project.yml β .xcodeproj)
cd CrystalCaper
xcodegen generate
# 2. Build & run on a booted simulator
xcodebuild -project CrystalCaper.xcodeproj -scheme CrystalCaper \
-destination 'platform=iOS Simulator,name=iPhone 17' build
# 3. Or just open it and hit βR
open CrystalCaper.xcodeproj- On-screen: β βΆ pads (bottom-left) to move, JUMP (bottom-right) to jump.
- Hardware keyboard (great in the simulator):
A/βandD/βto move,Space/W/βto jump. - Attract / self-test mode: launch with
CC_AUTOPLAY=1set and an autopilot plays the level hands-free β used for headless on-device verification.
- Reach the flag. Run right across three pits and three patrolling mushrooms to the checkered goal flag. Watch the win screen tally your gems and award a per-life bonus.
- Stomp a mushroom. Jump and come down on top of a Grumpcap β it squashes and pops for +250. Touch one from the side instead and you'll lose a heart (with a brief invulnerability blink).
- Go for the high route. The second floating step (top-right of ground C) holds two bonus crystals that need a precise full-height jump to reach.
- Feel the jump assists. Walk off a ledge and tap jump a hair late β coyote time still launches you. Tap jump just before landing β the jump buffer fires it on touchdown.
- Fall in a pit on purpose. You'll respawn at the start, down a heart. Lose all three and the Game Over screen appears β tap anywhere to play again.
- Ride a moving platform. From level 4 up, some floating ledges drift back and forth (or up and down). Hop aboard β it carries you along its path. Time your jump off to reach crystals you couldn't otherwise.
- Beat the boss. Every 5th level (5, 10, 15β¦) the goal flag is gated by King Grumpcap. He pauses and flashes red (a tell), then charges or lobs a slow spore. Stomp his head 3 times β dodge the side hits β for a big bonus, fireworks, and the goal that opens behind him.
- Make the global board. Once the leaderboard backend is deployed, your final score (initials + level reached) posts to a shared online high-score board shown on the title and game-over screens β chase the worldwide top 20, not just your own best.
Sprites live in Resources/ as flat PNGs, loaded by name (pip_idle_0.png, grump_walk_0.png, tile_surface.png, β¦). Every art asset was generated with the PixelLab MCP:
- Pip the Fox β humanoid side-view character +
idle,run,jumpanimations (east-facing; mirrored for west). - Grumpcap β mushroom enemy +
walkanimation. - King Grumpcap β the boss (every 5th level): a larger, crowned, armored mushroom. Currently a hand-drawn procedural placeholder (
bossPlaceholder()inAssets.swift, mirrored on Canvas in the web port) to conserve the PixelLab trial budget; the loader adopts realboss_*.pngframes automatically if they're generated later. - Forest tileset β a 16-tile Wang sheet, sliced + composited into a grass-capped surface tile and a dirt fill tile.
- Sound effects β five chiptune SFX (jump, gem, stomp, hurt, win) synthesized in pure Python, no samples.
Until a real asset is present, Assets.swift draws a hand-coded procedural placeholder of the same proportions, so the game is fully playable at every stage of integration. The full, reproducible pipeline (PixelLab IDs + the slicing/synthesis scripts) is documented in Tools/README.md.
Sources/
CrystalCaperApp.swift App entry (landscape, full-screen)
GameView.swift SwiftUI SpriteView host
GameConfig.swift All tuning constants + physics categories + Z layers
GameScene.swift World build, physics, input, camera, moving platforms, win/lose
Player.swift Hero entity + animation state machine
Enemy.swift Patrolling mushroom
Boss.swift "King Grumpcap" boss state machine (telegraph/charge/projectile)
Collectibles.swift Gem + goal flag factories
LevelData.swift Level structs + procedural generator (incl. moving platforms)
Assets.swift Texture loading + procedural placeholders
Effects.swift Particle bursts + floating score text
Leaderboard.swift Shared online high-score client (URL-flag-gated)
ParallaxBackground.swift Scrolling sky + hill bands
Resources/ Generated PixelLab PNGs
leaderboard/ Cloudflare Worker + KV backend (deploy + test harness)
Tools/web_harness.mjs Headless validator for the web port (genLevel + game loop)



