minigame

command
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Catch the Star

The smallest mini game worth trying on a phone: a star jumps around the screen, every tap on it scores, a round lasts 20 seconds, and the best score is kept in storage.

It makes no network request, so it runs on a device before the MP console lists any server domain. The score bar sits at the bottom, inside the safe area, because WeChat keeps its capsule button over the top right corner (#3116).

Run it

  1. Give it the game's AppID from the MP console in nsgo.yaml. WeChat's developer tool opens no mini game without one, and a test account's AppID works too:

    minigame:
      appid: { wechat: wx0123456789abcdef, douyin: tt0123456789abcdef }
    
  2. Build it and open it in WeChat's developer tool, with its service port on (Settings, Security):

    go tool nsgo build -target minigame_wechat -run examples/minigame
    

    minigame_douyin builds Douyin's, and -target minigame builds both.

  3. Try it on a phone: preview it and scan the QR code with WeChat.

    go tool nsgo publish miniprogram -target minigame_wechat -preview qr.png examples/minigame
    

Test it

go tool nsgo test ./examples/minigame

app_test.go plays a round on a manual clock: three taps score 3, the round ends after 20 seconds, and the best score is shown and stored.

Mini games in the building guide cover the rest: subpackages, audio, networking and what is not drawn yet.

Documentation

Overview

Command minigame is the smallest mini game worth trying on a phone: a star jumps around the screen, every tap on it scores, a round lasts 20 seconds, and the best score is kept in storage. It needs no network, so it runs on a device before the MP console lists any server domain. Build it with go tool nsgo build -target minigame_wechat examples/minigame (minigame_douyin for Douyin's), and add -run to open it in the developer tool, whose Preview gives a QR code for a phone.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL