Skip to content

gamedev-skills/awesome-gamedev-agent-skills / skills/ebitengine/ebitengine-game

ebitengine-game

Verified

Creates, debugs and packages 2D games in Go with Ebitengine v2: a play-and-retry loop, input, pixel-art scaling, text, audio and desktop, WASM or mobile builds. Use when go.mod requires ebiten/v2 or the user wants a game in Go, or on blurry pixel art, missed key presses or stutter. Not for engine patches; pair with `game-feel`, `game-ui-ux` or a genre skill for design.

assets/starter/main.go

View on GitHub
// Starter game for Ebitengine v2.10: title screen, a small platformer level,
// keyboard/gamepad/touch input, text, sound and pause.
//
//	go run .                          play
//	go run . -demo -shot out.png      scripted input, save the screen at tick 240, exit
package main

import (
	"flag"
	"fmt"
	"log"

	"github.com/hajimehoshi/ebiten/v2"
)

// version is stamped by release builds: go build -ldflags "-X main.version=1.2.0".
var version = "dev"

// The logical screen. Everything is drawn in these units; Ebitengine scales the
// result to the window.
const (
	screenW = 640
	screenH = 360
)

func main() {
	shot := flag.String("shot", "", "write a PNG of the screen to this path and exit (headless checks)")
	shotTick := flag.Int("shot-tick", 240, "tick at which -shot is taken")
	demo := flag.Bool("demo", false, "drive the game with a fixed input script instead of devices")
	showVersion := flag.Bool("version", false, "print the version and exit")
	flag.Parse()
	if *shotTick < 1 {
		log.Fatal("-shot-tick must be positive")
	}
	if *showVersion {
		fmt.Println(version)
		return
	}

	g, err := NewGame(Options{ShotPath: *shot, ShotTick: *shotTick, Demo: *demo})
	if err != nil {
		log.Fatal(err)
	}

	ebiten.SetWindowTitle("Starter")
	ebiten.SetWindowSize(screenW*2, screenH*2)
	ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
	if *shot != "" {
		// Exactly one Update per Draw makes the requested tick reproducible.
		// This capture mode runs as fast as possible; interactive play uses 60 TPS.
		ebiten.SetTPS(ebiten.SyncWithFPS)
		ebiten.SetVsyncEnabled(false)
		ebiten.SetWindowVisible(false)
		ebiten.SetRunnableOnUnfocused(true)
	}

	if err := ebiten.RunGame(g); err != nil {
		log.Fatal(err)
	}
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 323kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall