patrickz.aiLet’s talk ↗

Build apps / Project lab

Build one mobile combat encounter

Make movement, one attack and restart work across keyboard and touch.

About 90 minutesSome experienceRead free · No sign-up

Before you start

A coding agent, browser and placeholder shapes. Follow the repository’s current setup instructions.

Why this lesson exists

This lab adapts the “Prototype a Mobile Browser Brawler With Phaser” project write-up into a practice build. The time is an estimated first session, not a promise to finish a production system. Use the public repository as a reference when available; the exercise can be built with original sample content.

Do the exercise

  1. Define the practice version

    Use one player, one enemy, health, attack cooldown and restart. Route input methods to the same actions.

  2. Build step 1

    Make a title scene and one combat scene.

  3. Build step 2

    Add movement before enemies.

  4. Build step 3

    Draw temporary hitboxes so attacks are visible during development.

  5. Build step 4

    Add one enemy that chases, attacks on cooldown, and can be knocked back.

  6. Build step 5

    Add health, game over, and restart.

  7. Build step 6

    Add touch controls after keyboard behavior is stable.

  8. Build step 7

    Publish early and tune feel from real devices.

  9. Run the experiment

    Move and attack simultaneously on touch. Lose, restart, rotate the device and test again. Display hitboxes while checking whether attacks connect.

A prompt to adapt

Replace the bracketed parts with your own practice details.

Work in a disposable practice project. Explain any setup requirements before changing files. Build one small step at a time and show how I can check it.

Build a Phaser 3 combat prototype plan with one player, one enemy, health, punch, knockback, and restart. Separate entity state from collision handling. Include visible debug hitboxes and a tuning table for speed, range, cooldown, and damage.

Review these touch controls for a mobile action game. Check thumb reach, simultaneous movement and attack, accidental presses, orientation changes, safe-area insets, and controller fallback.

My first-version boundary: Use one player, one enemy, health, attack cooldown and restart. Route input methods to the same actions.

Run this experiment

Move and attack simultaneously on touch. Lose, restart, rotate the device and test again. Display hitboxes while checking whether attacks connect.

Check your result

Use evidence from your output. A confident explanation from the AI is not enough.

  • Keyboard and touch invoke the same game actions.
  • Restart clears enemy and player state.
  • An attack cannot deal damage repeatedly every frame.

If it isn’t working

If combat feels random, make collisions visible and record cooldown values before adjusting art or effects.

Where this came from

Public project repository ↗. The practice lesson is an adaptation, not a verbatim transcript. About the sources.

Prepared September 2026. Tools and interfaces change; use current official setup instructions. Session lengths are estimates.

KEEP GOING

Your next useful step

Browse all 59 guides ↗