GitHubНачать

Эта страница ещё не переведена на русский язык, поэтому ниже показан английский оригинал.

Ещё

Tap2D template

Tap2D is a portrait-first one-touch endless game for phones, web portals and mini-game shells. The player taps to move through lanes while obstacles move toward the player. A tap after the run ends, or the Retry button, resets the in-memory run immediately, and the best score persists through save.Store.

What it demonstrates

  • The full-screen canvas takes touch and mouse presses, and input.Actions binds the same tap to Space, Enter and a gamepad button.
  • game.Loop advances deterministic run rules at a fixed rate.
  • data/difficulty.yaml keeps speed, score ramp, obstacle spacing and width in strict versioned YAML.
  • save.Store persists the best score between sessions.
  • Headless nsgotest tests cover tapping, retry, difficulty, obstacle motion and canvas output.

Saving the best score

Tap2D preserves the stored score if the save came from a newer version or cannot be recovered. New scores are tracked for the current session. Update the game to open a newer save.

If a write fails, choose Retry save to write the current best score. Free up space first if the notice says storage is full. Save details lets you copy the slot error, game version and build for support. The English and Chinese notices live in strings/.

Run it from template/tap2d/template with go tool nsgo dev, or run go tool nsgo test ./.... Replace the procedural rectangles in game.go with the game's art and add platform services at the save and game-over hooks.

Редактировать страницу