Build a dinosaur runner game with Deno, pt. 5
Part five of a Deno tutorial series adds player identity and customization to a browser dinosaur runner game. Plain DOM modals collect a player name and preferences for dino color, background theme and difficulty. The DinoGame class loads settings from the server or localStorage and applies theme gradients and difficulty speed multipliers (0.8/1.0/1.3). New PostgreSQL `players` and `player_settings` tables back Oak routes under `/api/customization`, which use INSERT ... ON CONFLICT upserts to persist those choices.
Related posts
- Build a dinosaur runner game with Deno, pt. 4
Deno mediumAdeptPart four of the Deno dino runner series adds score persistence: a leaderboard HTML page that polls an API every 30 seconds, a managed Prisma Postgres database provisioned in Deno Deploy, and Oak routes to submit and rank scores. It covers connecting locally via `deno run --tunnel` or a DATABASE_URL with sslmode=require, and a lazily created npm:pg connection pool that falls back across three sets of credential environment variables. The scores table gets a descending index on score and timestamp, created by a startup migration script, and rank is computed with a COUNT query after insert.
- Build a dinosaur runner game with Deno, pt. 3
Deno mediumAdeptPart 3 of a Deno tutorial series adds obstacles and collision detection to a canvas-based dinosaur runner game. Cactus obstacles spawn on a frame timer, move left at the game speed, and award points when they leave the screen. An axis-aligned bounding-box overlap check ends the run, and a difficulty level computed every 200 points raises speed and shortens the spawn interval down to a floor. The stage also adds a simple leg animation, a game-over overlay, high scores persisted in localStorage, and redeployment with `deno deploy`.
- Build a dinosaur runner game with Deno, pt. 2
Deno mediumAdeptStage 2 of a Deno dinosaur runner tutorial turns a static landing page into a playable HTML5 canvas game. A DinoGame class tracks game state, runs a requestAnimationFrame update/render loop, handles Space, arrow-up and click input for jumping, and applies simple gravity and velocity physics with a ground clamp. The stage also covers canvas rendering of a rectangle dino, DOM score and status helpers, reset logic and a health check against the Stage 1 Oak API, all deployable to Deno Deploy.
- Build a dinosaur runner game with Deno, pt. 1
Deno mediumAdeptPart one of a series building a browser dinosaur runner game sets up a Deno project that serves static files and deploys it. It covers `deno init`, adding the Oak framework from JSR, defining `dev` and `start` tasks in deno.json with explicit `--allow-net`/`--allow-read`/`--env-file` permissions, and a minimal Oak server that serves `public/` via `context.send`. It also adds an `/api` router with a health check endpoint, then deploys with `deno deploy` using `src/main.ts` as the entry point.
- Persist Data in Deno with npm using Prisma, Mongoose, Apollo, and more.
Deno mediumAdeptDeno's npm: specifiers let you use popular data-layer packages directly, with Deno's opt-in permission flags limiting what a possibly compromised dependency can reach, such as environment variables holding database credentials. Three quick-start walkthroughs follow. Prisma is initialized against a Supabase PostgreSQL database and routed through Prisma Data Platform's Data Proxy. A Mongoose schema with validations writes to and reads from MongoDB. An Apollo GraphQL server defines typeDefs and resolvers over a static dataset.