# Build a Vertical Scrolling Space Shooter

**A BEGINNER'S GUIDE · BROWSER GAME · $0 BUDGET · FREE TOOLS ONLY**

Build a complete arcade space shooter — 8 stages, boss fights, power-ups, sound effects — in plain JavaScript, and publish it on the internet for free. No experience needed beyond VS Code. No money needed at all.

**1942 mechanics** · Spaceship look · **Free AI-generated sprites** · VS Code + GitHub Copilot · **Publish on itch.io or GitHub Pages**

## Who This Guide Is For

You have VS Code installed and you want to make a real, playable game. You don't need to know JavaScript already — the guide explains every piece as it comes up, and four ready-to-paste prompts let GitHub Copilot (free) write the boilerplate for you. If you can create a folder, install a VS Code extension, and copy and paste, you can finish this.

## What You'll End Up With

A vertical scrolling space shooter in the style of the 1984 arcade classic 1942: your spaceship flies up through 8 sectors, shooting alien fighters, weavers, kamikazes, and gunships, collecting power cores, and fighting two capital ship bosses. It runs in any browser, works on phones with touch controls, saves the high score, and plays sound effects — all from three small files and a folder of images. When it's done, you'll publish it on itch.io or GitHub Pages and send people a link.

## What You Need — All Free

| You need | What it is | Cost |
|---|---|---|
| VS Code | The code editor this guide assumes you already have installed (code.visualstudio.com) | Free |
| A free GitHub account | For GitHub Copilot Free (the AI coding helper) and, if you want it, GitHub Pages hosting | Free |
| A free Google account | For image generation in the Gemini app (your sprites) | Free |
| A free itch.io account | Only if you publish on itch.io (the easiest option) | Free |

That's it. Everything in this guide is free: no paid tools, no paid assets, no paid hosting. Limits change over time, so re-check the linked pages if a number in this guide looks out of date — the guide is dated November 28, 2026.

## 1. The Plan — Decisions Locked

This guide makes the decisions once, up front. Nothing in here is an option to weigh later. Build v1 exactly like this, and you'll have a finished game instead of a half-finished experiment.

### Locked for v1:

**Game:** vertical scrolling space shooter, 1942 mechanics, spaceship look. Your ship vs alien ships. **Code:** plain JavaScript + HTML5 Canvas. One `index.html`, two JavaScript files: `game.js` (the core engine) and `stages.js` (the 8 scripted stage timelines). No framework, no build step, nothing to install beyond VS Code. **Canvas:** 480x640 portrait — that's the size of the play area, in pixels. **Stages:** 8. One per sector: Sirius, Vega, Rigel, Betelgeuse, Antares, Polaris, Altair, Deneb. Capital ship bosses at stages 4 and 8. Stage 8 is the LAST STAGE. **Lives:** 3. Extra life at 50,000 and 150,000 points. **Graphics:** you make every sprite in the Gemini app (Google's free AI image tool). No other sprite source for v1. Phase 1 runs on geometric placeholder shapes first — the real sprites swap in later, at the handoff in Section 7. **Sound:** jsfxr, generated in code. The `sfxr.js` library file sits in the game folder, loaded locally — no CDN, no audio files. No music in v1. **Local testing:** VS Code Live Server (Section 4). **Publishing:** itch.io or GitHub Pages (Section 11) — your choice, both free.

## 2. What to Copy from 1942 — The Mechanics, Not the Look

1942 is Capcom's 1984 arcade vertical scrolling shooter. You play a fighter plane flying over the Pacific. This game takes its mechanics and puts them in space: your spaceship against alien ships. The look is yours. The mechanics are the homage. **Copy the mechanics, not the assets.** Capcom owns the 1942 sprites, music, and name. Make your own ships, your own title, your own music. "Inspired by 1942" is fine; ripping the ROM art is not.

| Mechanic | How 1942 does it | In your game (spaceships) |
|---|---|---|
| Scrolling | Screen scrolls down continuously (player flies "up"); ocean, islands, and land scroll past | Starfield scrolls down continuously; stars, nebulae, and planets drift past |
| Stages | 32 stages, counted down from 32 to 1. Groups of four: Midway, Marshall, Attu, Rabaul, Leyte, Saipan, Iwo Jima, Okinawa. Stage 1 is the "LAST STAGE" | Same idea, shortened to 8 stages, one per sector: Sirius, Vega, Rigel, Betelgeuse, Antares, Polaris, Altair, Deneb. Stage 8 is the alien homeworld, the LAST STAGE |
| Controls | 8-way movement, 2 buttons: fire and loop | 8-way movement, 2 buttons: fire and barrel roll |
| Barrel roll (the loop) | Evasive maneuver: brief invincibility, can't shoot during it. 3 loops per life. The signature move — build the game around it | Same: about 0.9 seconds of invincibility, the ship spins, can't shoot, 3 rolls per life |
| Enemies | Small fighters in formations, larger bombers with more health, kamikaze divers, gunboats/ships on the water | Alien fighters in formations, larger alien gunships with more health, kamikaze divers, alien turrets and mines |
| Crimson squadrons | Waves of red planes in formations of 5 or 10. Destroy the whole formation and a POW drops | Waves of red alien ships in formations of 5 or 10. Destroy the whole squadron and a power core drops |
| Power cores | Green: weapon power-up (2 guns to 4 guns). White: destroys all enemies on screen. Gray: Side Fighters (two wingmen). Orange: enemies can't shoot for a time. Yellow: extra loops. Black: extra life. Red: 1,000 points | Same table, renamed: green weapon upgrade, white screen clear, gray wingman drones, orange no enemy fire, yellow extra roll, black extra life, red 1,000 points |
| Bosses | Four large boss planes, at the end of stages 26, 18, 10, and 02, worth 20,000 / 30,000 / 40,000 / 50,000 points | Two alien capital ships, at the end of stages 4 and 8, worth 30,000 and 50,000 points |
| Scoring | Small planes 30–200 points. Full 5-plane red formation: 500 bonus. Full 10-plane formation: 1,000 bonus. End-of-stage bonus for shoot-down percentage (100% = 50,000 points) and 1,000 points per unused loop. Finishing the final stage: 10,000,000 points | Same numbers — swap "planes" for "ships" and "loops" for "rolls" |
| Lives | 2 lives at start. Losing a life removes your weapon upgrades — you rebuild firepower from scratch | 3 lives at start (Section 1). Losing a life still removes your weapon upgrades |

## 3. The Tools — All Free

| Job | Tool | What it costs |
|---|---|---|
| Code | VS Code + GitHub Copilot, agent mode | Free (see the limits below) |
| Game code | Plain JavaScript + HTML5 Canvas — Canvas is the browser's built-in drawing surface; JavaScript is the language that tells it what to draw | Free, built into every browser |
| Sprites | Gemini app (gemini.google.com) — Google's free AI image tool, for generating the ship and background images | Free with a Google account (see the limits below) |
| Pixel art editing | Piskel (piskelapp.com, browser-based, free) | Free, no account needed |
| Image editing | Photopea (photopea.com, browser-based, free) | Free, no account needed |
| Sound effects | jsfxr (sfxr.me) — sounds generated in code, no audio files to manage. Download `sfxr.js` into the game folder and load it locally (Section 10). No CDN. | Free, public domain |
| Local testing | VS Code Live Server | Free, no account needed |
| Publishing | itch.io or GitHub Pages | Free |

### The two free-tier limits you should know about before you start

**GitHub Copilot Free gives you 2,000 code completions and 50 chat/agent requests per month.** A "completion" is the grey suggestion text that appears as you type — press Tab to accept it. A "chat/agent request" is every message you send to Copilot Chat, including every agent-mode prompt — and one agent task can use several requests behind the scenes. The allowance resets on the 1st of each month, it doesn't roll over, and there's no way to buy more on the free plan. This guide uses exactly four agent prompts (Section 8), so budget your requests: save them for the big steps, and use Tab-completions for small fixes. If you run out mid-project, you can keep going by hand — this guide explains every piece — and pick up the prompts again after the reset. (Students: GitHub's student plan includes unlimited completions.)

**The Gemini app's image generation is free with a Google account, but Google publishes no fixed daily image count.** Limits are based on how much computing each request uses, refresh every few hours up to a weekly cap, and are roughly a handful of images a day for free accounts. Downloads come out at 1K resolution, which is more than enough for sprites that get shrunk to 48 pixels. Two things to know: every generated image carries an invisible watermark (SynthID) that doesn't change how the image looks, and the small visible Gemini sparkle can be switched off in Settings in most countries. You need to be 13 or older to generate images (18+ to edit them). The practical advice: generate only the sprites the next phase needs (Section 9), not a whole library at once.

## 4. Set Up VS Code — Extensions, Copilot, and Your Project Folder

### Step 1 — Create the project folder

Make a new folder called `space-shooter` somewhere easy to find, like your Desktop or Documents folder. Everything in this guide goes inside it.

### Step 2 — Install the extensions

Extensions are add-ons that give VS Code extra abilities. You need three. In VS Code, click the Extensions icon in the left sidebar (or press Ctrl+Shift+X on Windows/Linux, Cmd+Shift+X on Mac). Type the name in the search box, then click **Install** on the right result.

1. **Live Server** by **Ritwick Dey** (the top result). This is how you run the game while you build it. Browsers block local file loading, so double-clicking index.html silently breaks images and audio. Live Server serves the folder over local HTTP instead. To run the game: right-click index.html in the Explorer and choose **Open with Live Server**. The game opens in your browser at http://127.0.0.1:5500/. To stop it: click the **Port: 5500** button in the bottom-right status bar. Live Server reloads the page every time you save a file, so the loop is: edit, save, see it in the browser.
2. **GitHub Copilot** — the AI coding helper.
3. **GitHub Copilot Chat** — the chat panel that runs agent mode. Agent mode needs both Copilot extensions.

### Step 3 — Sign in to Copilot

After installing, VS Code will ask you to sign in to GitHub. Use your free GitHub account (create one at github.com if you don't have one). That's what activates the free tier — no payment details are asked for.

### Step 4 — Open the project folder

**File → Open Folder**, then pick the `space-shooter` folder you made in Step 1. Run every prompt in Section 8 with this folder open, so the game files land in the right place from the start.

## 5. Project Layout

Your `space-shooter` folder will end up looking like this:

```
space-shooter/
|-- index.html    # the web page: canvas element, HUD, responsive CSS, loads sfxr.js, stages.js, game.js
|-- game.js       # core engine: game loop, rendering, physics, collision, HUD
|-- stages.js     # the 8 scripted stage timelines (STAGES array)
|-- sfxr.js       # jsfxr sound library, downloaded locally (added in Phase 5, Section 10)
+-- assets/
    |-- sprites/  # player-ship.png, enemy-fighter.png,
    |             # enemy-weaver.png, enemy-kamikaze.png,
    |             # enemy-gunship.png, boss-capital-ship.png,
    |             # power-core.png, background-starfield-far.png,
    |             # background-starfield-near.png
+-- (no sfx folder — sounds are generated in code)
```

Three files from the start: `game.js` stays clean because the stage data lives in `stages.js` — that keeps Copilot from losing track during Phases 3 and 4, when the timelines get long. `stages.js` holds only data: the `STAGES` array, one entry per sector, each with its timeline. `game.js` owns everything else: the loop, rendering, physics, collision, and HUD (the on-screen display: score, lives, and so on).

Script load order in `index.html`: `sfxr.js` first, then `stages.js`, then `game.js` last (it reads the stage data). Use standard `<script>` tags with relative paths — no modules, no bundler.

**Relative paths matter.** A relative path like `assets/sprites/player-ship.png` means "starting from this folder, go into assets, then sprites, then the file." It works the same on your computer, on itch.io, and on GitHub Pages. A path starting with `/` (like `/assets/sprites/player-ship.png`) means "starting from the website's root" — that breaks the moment the game lives in a subfolder, which is exactly where itch.io and GitHub Pages put it. Keep every path relative and you'll never hit this bug.

## 6. The Game, Piece by Piece — Loop, Player, Background

### Game loop

A game is a loop: update everything a little, draw everything, repeat — about 60 times a second. `requestAnimationFrame` is the browser's built-in way to run that loop. One `update(dt)` (move everything, spawn enemies, check collisions) and one `draw()` (background, entities, HUD). `dt` is "delta time" — the seconds since the last frame — and it's capped so that switching browser tabs for a minute doesn't teleport everything when you come back.

```js
let last = performance.now();
function loop(now) {
  let dt = Math.min((now - last) / 1000, 0.05);
  last = now;
  update(dt);
  draw();
  requestAnimationFrame(loop);
}
requestAnimationFrame(loop);
```

### Player

Moves with arrow keys / WASD, clamped to the screen. Speed 260 px/sec. Hold Space or Z to fire (autofire is fine too). **Hitbox smaller than the sprite.** The hitbox is the invisible area that counts as "you" when a bullet checks for a collision. The visible ship is big; the vulnerable point is a small circle in the middle. That makes the game feel fair. Barrel roll button (X or Shift): about 0.9 seconds of invincibility, the ship does a spin animation, can't shoot during it, 3 per life. Show remaining rolls in the HUD.

### Scrolling background

Two starfield layers (far and near), each drawn twice, one after the other, offsetting downward and wrapping — the classic seamless scroll. The near layer scrolls faster than the far layer. That parallax (things closer to you moving faster) is the whole depth effect, and it costs nothing.

**Phase 1:** the starfield is procedural — two layers of dots drawn in code (far layer: small dim dots, slow; near layer: larger bright dots, fast). No image files needed yet.

**After the sprite swap (Section 7):** the dots are replaced by the two starfield image layers from Section 9. Draw the far layer normally. **Draw the near layer with `ctx.globalCompositeOperation = 'screen'` (or `'lighter'`)** so its dark background drops out and doesn't cover the far layer. (Or generate the near layer with a transparent background and draw it normally — either way, the near layer must never paint an opaque dark rectangle over the far layer.)

## 6. The Game, Piece by Piece — Enemies and Waves

Don't spawn randomly. 1942 uses scripted waves — a timeline per stage: `[time in seconds, type, x position, pattern]`. Scripted waves make a shooter learnable: you can memorize what's coming and get better at it. Random feels unfair. The timelines live in `stages.js` as the `STAGES` array — one entry per sector, in order: Sirius, Vega, Rigel, Betelgeuse, Antares, Polaris, Altair, Deneb. `game.js` reads the current stage's timeline from it.

| Type | Behavior |
|---|---|
| Alien fighter | Flies down in a straight line or slight curve, occasionally fires one aimed shot |
| Alien weaver | Sine-wave path across the screen, harder to hit |
| Alien kamikaze | Locks onto the player's position and dives at it |
| Alien gunship | Slow, high health (8–10 hits), fires 3-way spreads, worth more points |
| Crimson squadron | 5 or 10 ships in formation; destroy all of them and a power core drops |
| Capital ship (boss) | Big ship, health bar, enters from the top, hovers and fires patterns in phases |

Stage 1 timeline (in `stages.js`):

```js
const STAGES = [
  { name: 'Sirius', timeline: [
    [1.0, 'fighter', 120, 'line'],
    [1.0, 'fighter', 200, 'line'],
    [1.0, 'fighter', 280, 'line'],
    [4.0, 'crimson5', 240, 'v-formation'],
    [8.0, 'fighter', 80, 'line'],
    [12.0, 'fighter', 360, 'line'],
  ]},
  // ... Vega, Rigel, Betelgeuse, Antares, Polaris, Altair, Deneb
];
```

**Difficulty ramp:** each stage increases enemy speed, fire rate, and health slightly, and adds new types. Stage 1 has fighters only; weavers arrive at stage 2, kamikazes at stage 3, gunships at stage 4.

## 6. The Game, Piece by Piece — Bullets, Bosses, Sound

### Bullets

Player bullets: fast, upward, one list. Enemy bullets: slower, aimed or spread patterns, a second list. **Object pooling:** reuse bullet objects instead of creating and destroying them every frame. Creating objects constantly makes the browser's garbage collector run, which causes stutter. Reusing them keeps the game at 60 fps. Cap the number of enemy bullets on screen (around 60–80) so later stages stay playable.

### Collision

Circle-vs-circle distance checks: player bullets vs enemies, enemy bullets vs player, enemies vs player (collision = death for both), player vs power core pickups. With a few dozen entities, plain distance checks are fast enough.

### Power cores

Copy the 1942 table from Section 2. All 7 cores: green weapon upgrade, white screen clear, gray wingman drones, orange no enemy fire, yellow extra roll, black extra life, red 1,000 points. The green weapon upgrade and gray wingman drones are the ones players chase; crimson squadrons are the reliable source. On death, lose the weapon upgrade and the wingmen — that's the 1942 punishment, and it's what makes the barrel roll worth saving.

### Boss fights

One capital ship boss at the end of stages 4 and 8. It enters from the top, stops at a hover point, and cycles attack patterns: aimed bursts, fan spreads, sweeping fire. Show a health bar. Defeating it ends the stage with a short bonus tally. Beat the stage 8 boss and you win — final score screen, then restart.

### Score, lives, game over

**HUD layout, fixed:** score top-left, high score top-center, lives (small ship icons) top-right. Barrel rolls remaining bottom-left, stage number bottom-right. High score saves in localStorage — the browser's built-in way for a web page to remember a small piece of data on your own computer. No server needed. 3 lives. Extra life at 50,000 and 150,000 points. Game over screen with final score, best score, and restart. Pause with P or Esc. Title screen with controls listed.

### Sound

Sounds are generated in code with the jsfxr library (Section 10) — the `sfxr.js` file sits in the game folder and loads locally, no CDN, no audio files at all. **Browsers block audio until the first user interaction.** Start all audio after the first click or keypress, or the game will be silent. Sounds needed: shoot, enemy explosion, player explosion, power-up pickup, roll whoosh, boss hit, stage clear jingle. No music in v1.

### Touch controls

Drag anywhere to move the ship (relative touch — the ship follows your finger's movement, not its absolute position, so your finger doesn't cover the ship). Autofire on by default on touch devices. A barrel roll button in the bottom corner. The canvas itself uses `touch-action: none` (Section 8, Scaffold prompt) so touch controls won't scroll or zoom the page. Test on your phone once the desktop version plays.

## 7. Build Plan — Playable at Every Step

| Phase | What you have | Done when |
|---|---|---|
| 1. Skeleton | Canvas, game loop, procedural scrolling starfield, player ship (placeholder triangle) moves and shoots, one enemy type (placeholder triangle) that flies down | You can fly around and shoot something — no sprites needed yet |
| 2. Combat | Enemy bullets, collision, explosions, score, lives, game over, restart | A complete (short) game loop exists |
| 3. Shooter identity | Waves/timeline (`stages.js`), crimson squadrons, power cores, weapon upgrade, wingman drones, barrel roll | It feels like 1942, looks like space |
| 4. Campaign | All 8 stages, capital ship bosses at stages 4 and 8, stage intro and bonus tally, difficulty ramp | A full playthrough exists |
| 5. Polish | Sound effects (local `sfxr.js`), title screen, touch controls, high score, pause | Ready to show people |
| 6. Ship | Published on itch.io or GitHub Pages (Section 11) | Anyone can play it from a URL |

Build in that order. Do not start with the boss or the music. There is no music — that's phase 5 of a later version, not this one.

**Sprite swap handoff (between Phase 2 and Phase 3):** once movement, shooting, barrel roll, hitboxes, and collision feel right, swap in the AI-generated PNG sprites (Section 9). Generate the sprites, drop them into `assets/sprites/`, replace the shape-drawing code with `drawImage` calls at the same sizes and hitboxes, and switch the starfield from procedural dots to the two image layers (near layer drawn with `'screen'` blending). Done when the game looks like the sprites and still plays exactly the same. Do not generate sprites before Phase 1 plays — the placeholders exist so you can feel the game first.

## 8. Copilot Prompts to Paste — Scaffold and Waves

You don't have to write this game from scratch. GitHub Copilot in agent mode can generate each phase from a prompt — you review what it writes, test it, and move on. The four prompts below are written to be pasted as-is.

### How to use them

1. Open Copilot Chat in VS Code (click the chat icon in the top-right of the sidebar, or press Ctrl+Alt+I on Windows/Linux, Cmd+Option+I on Mac).
2. At the bottom of the chat panel, switch the mode to **Agent**. (If you only see "Ask" and "Edit", make sure both Copilot extensions from Section 4 are installed and you're signed in.)
3. Paste one prompt, press Enter, and wait. Copilot will propose file changes — review the diff (the list of added and changed lines), and accept it when it looks right.
4. Run the game with Live Server and check that the phase works. If something's off, describe the problem to Copilot in the same chat and it will fix it.
5. Then paste the next prompt.

Remember the budget from Section 3: you get 50 chat/agent requests a month on the free plan, and one agent task can use several. Four prompts is the plan — that leaves room for a few fixes. Save requests by letting inline completions (the grey Tab suggestions) handle small edits, and don't re-run a prompt that already worked. If you run out, the allowance resets on the 1st, and everything in this guide is explained well enough to finish by hand.

You don't have to use Copilot at all. If you'd rather type the code yourself, or your free requests are used up, the guide tells you exactly what each phase contains — the prompts are a shortcut, not a requirement.

### Prompt 1 — Scaffold

```
--- START ---
In the open space-shooter folder in VS Code, create a vertical scrolling space shooter game, plain JavaScript and HTML5 Canvas, no frameworks, no build step. Three files: index.html, game.js (core engine, game loop, rendering, physics, HUD), and stages.js (the 8 scripted stage timelines as a STAGES array). Load them in index.html with standard script tags, stages.js before game.js. 480x640 portrait canvas. CSS scales the canvas cleanly on desktop and mobile: aspect-ratio: 3 / 4, centered on the page, sized to fit the viewport height and width, and touch-action: none on the canvas so touch controls won't scroll or zoom the page. Use crisp geometric placeholder shapes first: an orange triangle for the player ship, a green triangle for the enemy, rectangles for bullets, and a procedural two-layer dot starfield drawn in code (far layer small dim dots, near layer larger bright dots, near layer faster, both wrapping). No image files in Phase 1 — sprites come later. When the starfield image layers replace the procedural dots later, draw the near layer with ctx.globalCompositeOperation = 'screen' (or 'lighter') — or give it a transparent background — so its dark background drops out and doesn't cover the far layer. Player spaceship moves with arrow keys/WASD, fires with Space, barrel roll with X (0.9s invincibility, 3 per life, can't shoot during roll). One alien enemy type that flies down and shoots aimed bullets. Circle collision, score, 3 lives, game over screen with restart. Use requestAnimationFrame with delta time and object pooling for bullets.
--- END ---
```

### Prompt 2 — Waves

```
--- START ---
Add a wave system to this game: 8 stages, each a timeline array of [time, enemyType, x, pattern]. Put the 8 stage timelines in stages.js as a STAGES array (one entry per sector: Sirius, Vega, Rigel, Betelgeuse, Antares, Polaris, Altair, Deneb), and have game.js read the current stage's timeline from it. Add enemy types fighter, weaver (sine path), kamikaze (dives at player), gunship (slow, 10 HP, 3-way spread). Add crimson squadrons of 5 ships: destroying all 5 drops a power core pickup. Power core types: green weapon upgrade (2 to 4 guns), gray wingman drones (two escorts), white screen clear, orange no enemy fire (enemies can't shoot for a time), yellow extra barrel roll, black extra life, red 1000 points.
--- END ---
```

## 8. Copilot Prompts to Paste — Boss and Polish

### Prompt 3 — Boss

```
--- START ---
Add a boss fight at the end of stages 4 and 8: a large alien capital ship that enters from the top, hovers, has a health bar, and cycles three attack patterns (aimed bursts, fan spread, sweeping fire). Defeating the boss shows a stage-clear bonus screen (shoot-down percentage and unused barrel rolls) then starts the next stage. Beating the stage 8 boss shows the game-won screen.
--- END ---
```

### Prompt 4 — Polish

```
--- START ---
Add Web Audio sound effects using the jsfxr library for shoot, explosion, power-up, and barrel roll sounds. Download the jsfxr library file sfxr.js from https://sfxr.me/sfxr.js into the game folder and load it with a local script tag in index.html (before game.js). No CDN, no audio files — all sounds generated in code. Add a title screen, pause with P, high score saved in localStorage, and touch controls: drag to move, autofire on touch devices, on-screen barrel roll button.
--- END ---
```

## 9. Sprites in the Gemini App

Every sprite comes from the Gemini app's image generation (gemini.google.com, free with a Google account). One style prompt, reused for the whole set, so the ships look like they belong in the same game.

| Sprite | File | Size in game |
|---|---|---|
| Player ship | player-ship.png | 48 x 48 |
| Alien fighter | enemy-fighter.png | 40 x 40 |
| Alien weaver | enemy-weaver.png | 40 x 40 |
| Alien kamikaze | enemy-kamikaze.png | 36 x 36 |
| Alien gunship | enemy-gunship.png | 64 x 48 |
| Capital ship (boss) | boss-capital-ship.png | 160 x 120 |
| Power core | power-core.png | 28 x 28 |
| Starfield, far layer | background-starfield-far.png | 480 x 480 tile |
| Starfield, near layer | background-starfield-near.png | 480 x 480 tile |

Bullets are drawn in code, not sprites: player bullet 8 x 16, enemy bullet 6 x 6. Generate every sprite at 512px (backgrounds at 1024px), then shrink it down to the size in the table with a nearest-neighbor filter — that keeps the pixels crisp instead of blurry. The easiest way to shrink: open the PNG in Photopea (photopea.com, free, no account), go to **Image → Image Size**, type the exact width and height, and export as PNG.

### The prompts — one base style, one ship description each

Base style, in every prompt: "top-down 2D game sprite, pixel art style, single ship centered, plain solid magenta (#FF00FF) background, no shadows, no text". Add the ship description — the player faces up, every enemy faces down:

1. **Player ship:** "sleek player fighter spaceship, orange and cyan accents, dark hull, facing up"
2. **Alien fighter:** "alien fighter spaceship, green and purple hull, swept wings, facing down"
3. **Alien weaver:** "alien dart spaceship, purple hull, curved wings, facing down"
4. **Alien kamikaze:** "alien spike spaceship, red and black hull, pointed nose, facing down"
5. **Alien gunship:** "alien gunship spaceship, wide armored hull, heavy guns, green hull, facing down"
6. **Alien capital ship:** "alien capital ship, huge, layered armor, glowing core, green and purple, facing down"
7. **Power core:** same base style but "single object centered" and "glowing power core, small hexagonal energy cell, cyan glow"
8. **Starfield, far:** "seamless tileable starfield background, dark space, small dim white stars, faint purple nebula, pixel art style, no ships, no text"
9. **Starfield, near:** "seamless tileable starfield background, pure black background, large bright white stars, pixel art style, no ships, no text"

### Workflow

1. **Phase 1 uses placeholder shapes — no sprites needed.** Get the game playing first.
2. **Sprite swap handoff (after Phase 2, when movement, shooting, barrel roll, hitboxes, and collision feel right):** generate the sprites, starting with the player ship, one alien fighter, and the starfield far layer. Drop the PNGs into `assets/sprites/`, replace the shape-drawing code with `drawImage` calls at the same sizes in the table above, and switch the starfield from procedural dots to the two image layers.
3. Generate at 512px (backgrounds at 1024px), then shrink to the sizes in the table above. In Photopea: **Image → Image Size**, exact width and height, export as PNG.
4. Remove the magenta (#FF00FF) background in Photopea (free, browser-based) with **Select → Color Range**, picking the magenta — that leaves the ship on a transparent background. The background is magenta on purpose: the alien fighter, gunship, and capital ship have green hulls, so a green background would punch holes in them.
5. Draw the near starfield layer with `ctx.globalCompositeOperation = 'screen'` (or `'lighter'`) so its dark background drops out and the far layer shows through. (Or generate the near layer with a transparent background and draw it normally — either way, the near layer must never paint an opaque dark rectangle over the far layer.)
6. Pass one finished sprite back in as a reference image for the next generation, to keep the style consistent across the set. (Free accounts have limits on multi-image references — if it won't take a reference, just reuse the same base style prompt.)
7. Generate only what the next phase needs.

### Don't want to use AI images at all?

Two free options. **Draw the sprites yourself in Piskel** (piskelapp.com) — free, no account, built for exactly this: pixel-art ships on a grid, export as PNG. A recognizable spaceship takes minutes to draw, and the game's placeholder triangles already prove it plays fine with simple art. This is the recommended no-AI path: your art, no licensing questions at all. Or **Kenney** (kenney.nl) — every asset there is CC0 (public domain): free to use, no attribution needed, no account needed. Kenney has space-shooter packs with ships and backgrounds. Pick one source and use it for the whole set so the style matches.

## 10. Sound — jsfxr, in Code, No Audio Files

The jsfxr library file is called `sfxr.js`. Download it from https://sfxr.me/sfxr.js into your game folder and load it with a local `<script src="sfxr.js"></script>` tag in `index.html` (before `game.js`). No CDN, no audio files — the game stays completely self-contained. Sounds are generated in code from presets. The library is public domain (the Unlicense), so you can use it in any project, free or commercial, with no credit required.

**Watch the filename:** the file is `sfxr.js`, not `jsfxr.js`. The project is called jsfxr, but the library file is `sfxr.js` — typing the other name gives you a 404 and a broken game.

| Sound | jsfxr preset |
|---|---|
| Player shoot | laserShoot |
| Enemy explosion | explosion |
| Player explosion | explosion, lower pitch |
| Power-up pickup | powerUp |
| Player hit | hitHurt |
| Boss hit | explosion, short |
| Stage clear | pickupCoin |

The roll whoosh is a short noise sweep built in jsfxr — the polish prompt in Section 8 asks Copilot to generate it. No music in v1.

## 11. Publishing Your Game — itch.io or GitHub Pages

Phase 6 is putting the game on the internet so anyone can play it from a link. Both options are free. **itch.io is the easiest** — upload a zip and you're done. GitHub Pages is the better pick if you want a `github.io` address and a version history. Pick one; the game files are identical either way.

### Option A — itch.io (recommended)

1. Create a free itch.io account at itch.io (email + username). There's no fee to publish or host a game.
2. Click your username menu in the top-right corner and choose **Upload new project** (or go to itch.io/game/new).
3. Fill in the form: **Title** (your game's name), **Project URL** (auto-generated from the title — this becomes part of your game's address), **Short description**, **Classification: Games**, **Kind of project: HTML**, **Pricing: No payments** (free, no payment prompt at all).
4. Make the zip. **Zip the contents of your game folder, not the folder itself.** Open the game folder, select everything inside it (Ctrl+A on Windows/Linux, Cmd+A on Mac), then right-click → **Compress to → ZIP File** (Windows 11) or **Send to → Compressed (zipped) folder** (Windows 10 — on Windows 11 click **Show more options** first if "Send to" isn't visible), or **Compress** (Mac, Finder). Open the zip and confirm `index.html` is right at the top level, not inside a folder. If it's inside a folder, the game won't load — this is the most common itch.io mistake.
5. In the **Uploads** section, upload the zip, then tick the checkbox **"This file will be played in the browser."** (Skip this and the zip is just a download.)
6. Set the **Embed options**: **Embed in page**, viewport dimensions **480 × 640**, **Fullscreen button on**, **Mobile friendly on**, **Click to play on** (leave it on — it stops the game slowing the page down, and it's the click that makes audio work), **Orientation: Portrait**.
7. Add a cover image (630×500 px) and a longer description if you want — they help people find the game.
8. Save as **Draft**, open the page, and play the game in the embed to confirm it works. Then edit the project and set visibility to **Public**. Your game lives at `https://<your-username>.itch.io/<project-url>`.
9. To update later: upload a new zip, tick "This file will be played in the browser" on the new file, and delete the old one. Hard-refresh the page (Ctrl+F5 / Cmd+Shift+R) to see the new version.

Two itch.io quirks to know: the game runs inside a frame on itch.io's page, and browsers that block third-party storage can wipe the saved high score — the game still plays fine, only the saved score is at risk. And missing files show up as a 403 error in the browser console (F12), not a 404 — a 403 almost always means a wrong path or a filename with the wrong capital letters.

### Option B — GitHub Pages

1. Create a free GitHub account at github.com if you don't have one.
2. Create a **public** repository named after the game (e.g. `space-shooter`, lowercase, no spaces — the name becomes part of the URL). GitHub Pages on the free plan only works from public repositories. Tick **Add README** when creating it.
3. Upload the game files: open the repository, click **Add file → Upload files**, and drag your whole game folder onto the upload area — dragging a folder keeps its subfolders (like `assets/sprites/`) intact. (The file picker selects files only, not folders — drag-and-drop is the way to upload a folder.) Scroll down, type a commit message like "Add game files", and click **Commit changes**. Browser upload handles up to 100 files at a time, 25 MB each — a small game is far under that. If you expect to update often, install the free **GitHub Desktop** app (desktop.github.com) instead — it makes repeat updates a two-click job.
4. Optional safety step: add an empty file named `.nojekyll` at the repository root (repository → **Add file → Create new file**, name it `.nojekyll`, leave it empty, commit). GitHub Pages runs sites through Jekyll by default, which silently skips files starting with `_` — this game has none, but the empty file turns Jekyll off entirely and protects you if you ever add one.
5. Turn on Pages: repository **Settings → Pages → Build and deployment → Source: Deploy from a branch → Branch: main → Folder: / (root) → Save**.
6. Wait a few minutes (up to 10), then open `https://<your-username>.github.io/<repository>/`.
7. To update later: upload the changed files again (or push with GitHub Desktop) — the site redeploys automatically within about 10 minutes. Hard-refresh if your browser shows the old version.

One GitHub Pages quirk to know: the site is case-sensitive, but Windows and macOS are not. `Player-Ship.png` in your code and `player-ship.png` on disk will work locally and fail (404) live. Match filename case exactly everywhere — the game's filenames are all lowercase already, so just keep them that way. And like itch.io, absolute paths (starting with `/`) break on a project site — keep everything relative, as Section 5 says.

## 12. What You're Not Setting Up for v1

**Local AI is deferred, not cancelled.** A full local pipeline — ComfyUI + SDXL for images, Blender + 3D tools for models — is a project of its own, and it slows down getting a playable game. For v1, the Gemini app in the browser makes every sprite you need. Nothing to install, nothing to configure, no local models to manage.

Revisit local tools after the game is playable — for example, pre-rendered sprites from a Blender model, or batch-generating sprite variants locally. If v1 ever outgrows plain Canvas, Phaser is the upgrade path — revisit after the game is live, not before.

## 13. Troubleshooting

**The game page is blank, or nothing happens when I open index.html.** Don't double-click index.html — browsers block local file loading, which silently breaks images and audio. Run it with Live Server (right-click index.html → Open with Live Server) and open http://127.0.0.1:5500/.

**The game loads but the ships are missing (invisible ships, or broken-image icons).** Check two things: the image files are in `assets/sprites/` with the exact names in Section 9, and the code refers to them with relative paths (`assets/sprites/player-ship.png`, not `/assets/...`). Also check the capital letters match exactly — `player-ship.png` and `Player-Ship.png` are different files on a server.

**The ships have colored boxes around them.** The magenta background wasn't removed. Open the sprite in Photopea, use **Select → Color Range**, click the magenta, delete it, and export as PNG (which keeps transparency). Make sure you exported PNG, not JPG — JPG can't be transparent.

**No sound.** Browsers block audio until you click or press a key. Click the game or press a key first. On itch.io, leave **Click to play** on — it gives the player that click.

**The game is too big or too small on my phone.** The Scaffold prompt (Section 8) makes the canvas scale to the viewport with `aspect-ratio: 3 / 4` and `touch-action: none`. If it doesn't, check that the CSS from the prompt is in index.html — the canvas needs both rules.

**Copilot says I've run out of requests.** The free plan gives 50 chat/agent requests a month (Section 3). The allowance resets on the 1st. While you wait, you can keep building by hand — every phase is explained in Sections 6 and 7 — or use inline Tab completions, which come from the separate 2,000-a-month pool.

**Copilot's code has an error.** Paste the error message (from the browser console — press F12, click Console) into Copilot Chat and ask what's wrong. Or search the exact error text online; someone has hit it before.

**The game won't load on itch.io.** Open the zip and check `index.html` is at the top level, not inside a folder. Then check every file path is relative and every filename's capital letters match. A 403 error in the console means a wrong path or case mismatch.

**The game 404s on GitHub Pages.** Wait up to 10 minutes — the first publish isn't instant. Then check the repository's **Actions** tab for a failed deploy, and confirm `index.html` is at the repository root, not inside a folder.

**My high score doesn't save on itch.io.** Known quirk: the game runs in a frame on a different domain, and some browsers block its storage. The game still plays fine — only the saved high score is at risk. On GitHub Pages, or running locally, it saves normally.

## 14. Common Mistakes to Avoid

**Starting with a framework and a build step.** You don't need npm, a bundler, or TypeScript for a first 2D game. One HTML file, two JS files, open it. **Random enemy spawns.** Scripted waves are what make a shooter learnable and fun. Random feels unfair. **Hitbox the size of the sprite.** Shrink the player's hitbox. Every good shmup does this. **No object pooling.** Creating a new object per bullet per frame causes garbage-collection stutter. Reuse bullet objects. **Audio before interaction.** Browsers mute audio until the user clicks or presses a key. Start sound on first input. **Absolute asset paths.** /assets/player-ship.png breaks on a site subfolder like /games/space-shooter/ or on a project site. Use relative paths. **Copying someone else's art.** The mechanics are the homage; the art must be yours. Don't rip 1942 sprites, and don't lift spaceship art from other games — generate your own in the Gemini app, draw them in Piskel, or use a CC0 pack like Kenney. **Generating 50 sprites before the game plays.** Make the game play with placeholder shapes first, then generate sprites at the handoff (Section 7).

## Links

Gemini app (free image generation): https://gemini.google.com · VS Code: https://code.visualstudio.com · Live Server: install from the Extensions view in VS Code (search "Live Server", by Ritwick Dey) · Piskel pixel art editor: https://www.piskelapp.com · Photopea image editor: https://www.photopea.com · jsfxr sound generator and library: https://sfxr.me (download the library file sfxr.js from https://sfxr.me/sfxr.js) · GitHub Copilot plans (free tier limits): https://github.com/features/copilot/plans · itch.io: https://itch.io · GitHub Pages docs: https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site · GitHub Desktop: https://desktop.github.com · Kenney free game assets (CC0): https://kenney.nl · 1942 arcade reference: https://www.mobygames.com/game/7949/1942/ and https://nineteenforty.fandom.com/wiki/1942

Mechanics reference 1942 (Capcom, 1984); all art, names, and music in your game should be your own.

*Guide dated November 28, 2026. Free-tier limits and website layouts change — re-check the linked pages if something in this guide looks out of date.*
