GitHub快速開始

API 參考取自原始碼中的 Go 文件註解,以英文撰寫。

package pickups

import "github.com/nsgo-dev/game/pkg/pixelfx/pickups"

概覽

Package pickups is pixelfx's pickups category: coins, gems, crystals, hearts, keys, potions, power stars, XP orbs, loot beams, collect bursts and treasure chests, each a pixelfx.Effect registered as "pickups/<name>" when the package is imported.

索引

變數

var ChestOpen = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Chest open",
		Desc:     "A banded chest rattles with gold light leaking from its seam, the lid kicks open, rays fan up, and coins and gems arc out, bounce, glint and get collected.",
		Tags:     []string{"pickup", "chest", "treasure", "loot", "reward", "gold", "one-shot"},
		Size:     [2]int{176, 112},
		Origin:   [2]int{88, 96},
		Duration: 4.6,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1e1206", "#4a2c08", "#86520c", "#c48412", "#f0b424", "#ffe066", "#fff6c4", "#ffffff")},
			{Name: "wood", Default: pixelfx.Palette("#110a10", "#24131a", "#3a1f1f", "#552d24", "#73402c", "#925737", "#b07246")},
			{Name: "coins", Default: pixelfx.Num(12)},
			{Name: "seed", Default: pixelfx.Num(3)},
		},
	},
	New: newChestOpen,
}

ChestOpen is a banded chest that rattles with gold light leaking from its seam, kicks its lid open, fans rays up, and launches coins and gems that arc out, bounce, glint and get collected. It is registered as "pickups/chest-open".

var CoinSpin = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Coin spin",
		Desc:     "A thick gold coin turning on its edge: an embossed star face, a reeded rim showing as it goes edge-on, a flash sweeping the face, bobbing over its shadow.",
		Tags:     []string{"pickup", "coin", "gold", "money", "loop"},
		Size:     [2]int{56, 56},
		Origin:   [2]int{28, 48},
		Duration: coinSpinDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1e1206", "#4a2c08", "#86520c", "#c48412", "#f0b424", "#ffe066", "#fff6c4", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(3)},
		},
	},
	New: newCoinSpin,
}

CoinSpin is a thick gold coin turning on its edge: an embossed star face, a reeded rim showing as it goes edge-on, a flash sweeping the face, bobbing over its shadow. It is registered as "pickups/coin-spin".

var CollectBurst = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Collect burst",
		Desc:     "The moment of pickup: a white flash and a cross of light, a thin ring snapping out ahead of a softer one, twinkles thrown wide on curving paths that brake, hang and wink out.",
		Tags:     []string{"pickup", "collect", "burst", "sparkle", "reward", "one-shot"},
		Size:     [2]int{112, 108},
		Origin:   [2]int{56, 94},
		Duration: 1.35,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1a0516", "#3d0a33", "#701560", "#b0228f", "#f53cd1", "#ff86e6", "#ffd2f6", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(3)},
		},
	},
	New: newCollectBurst,
}

CollectBurst is the moment of pickup: a white flash and a cross of light, a thin ring snapping out ahead of a softer one, twinkles thrown wide on curving paths that brake, hang and wink out. It is registered as "pickups/collect-burst".

var CrystalShard = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Crystal shard",
		Desc:     "A broken amber shard hovers and sways: chipped uneven faces, its top sheared off, light pulsing up through glowing cracks and flaring out of the break; splinters orbit it.",
		Tags:     []string{"pickup", "crystal", "shard", "relic", "broken", "loop"},
		Size:     [2]int{64, 76},
		Origin:   [2]int{32, 68},
		Duration: crystalShardDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1a0a04", "#3e1606", "#702a08", "#a8480c", "#e07818", "#ffa838", "#ffd890", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(8)},
		},
	},
	New: newCrystalShard,
}

CrystalShard is a broken amber shard hovering and swaying with glowing cracks, a flaring break and orbiting splinters. It is registered as "pickups/crystal-shard".

var GemSpin = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Gem spin",
		Desc:     "A brilliant-cut ruby turning on its axis: real facets catch the light in turn, flashes roll over the crown, refracted light slides across the floor, sparkles wink round it.",
		Tags:     []string{"pickup", "gem", "jewel", "treasure", "ruby", "loop"},
		Size:     [2]int{64, 64},
		Origin:   [2]int{32, 56},
		Duration: gemSpinDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#16040e", "#3e0a1e", "#760e2e", "#b8163c", "#ec3250", "#ff7482", "#ffc4c8", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(6)},
		},
	},
	New: newGemSpin,
}

GemSpin is a brilliant-cut ruby turning on its axis: real facets catch the light in turn, flashes roll over the crown, refracted light slides across the floor, sparkles wink round it. It is registered as "pickups/gem-spin".

var HeartPickup = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Heart pickup",
		Desc:     "A plump glossy heart hovering over its shadow beats lub-dub: a big squash and stretch, a smaller echo, light and a thin ring pulsing out, tiny hearts drifting off.",
		Tags:     []string{"pickup", "heart", "health", "life", "loop"},
		Size:     [2]int{56, 60},
		Origin:   [2]int{28, 52},
		Duration: heartPickupDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1a0408", "#4a0a14", "#8a1222", "#d02436", "#ff4a56", "#ff8a8e", "#ffd0cc", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(4)},
		},
	},
	New: newHeartPickup,
}

HeartPickup is a plump glossy heart hovering over its shadow that beats lub-dub: a big squash and stretch, a smaller echo, light and a thin ring pulsing out, tiny hearts drifting off. It is registered as "pickups/heart-pickup".

var KeyGlint = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Key glint",
		Desc:     "An ornate silver key hovering and rocking; a glint runs from its bow down the shaft to the teeth and bursts off the tip as falling sparks.",
		Tags:     []string{"pickup", "key", "unlock", "item", "loop"},
		Size:     [2]int{72, 60},
		Origin:   [2]int{36, 54},
		Duration: keyGlintDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#0e1018", "#222838", "#3c4660", "#5e6d8e", "#8c9cbc", "#bccae2", "#e6eeff", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(7)},
		},
	},
	New: newKeyGlint,
}

KeyGlint is an ornate silver key hovering and rocking; a glint runs from its bow down the shaft to the teeth and bursts off the tip as falling sparks. It is registered as "pickups/key-glint".

var LootBeam = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Loot beam",
		Desc:     "A dropped sword in a tall pillar of rarity light: a white core thinning to the sky, rings pulsing across the floor, motes streaming up, a glint racing up the shaft.",
		Tags:     []string{"pickup", "loot", "beam", "rarity", "drop", "item", "loop"},
		Size:     [2]int{96, 176},
		Origin:   [2]int{48, 162},
		Duration: lootBeamDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#140a24", "#2c1250", "#4b1d86", "#7330c0", "#a050f0", "#c890ff", "#ecd4ff", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(4)},
		},
	},
	New: newLootBeam,
}

LootBeam is a dropped sword in a tall pillar of rarity light: a white core thinning to the sky, rings pulsing across the floor, motes streaming up, a glint racing up the shaft. It is registered as "pickups/loot-beam".

var Potion = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Potion",
		Desc:     "A round glass flask of glowing brew rocks in the air: the brew sloshes behind the rock, bubbles rise and pop, light glows through the glass, wisps curl off the cork.",
		Tags:     []string{"pickup", "potion", "flask", "brew", "magic", "loop"},
		Size:     [2]int{56, 72},
		Origin:   [2]int{28, 64},
		Duration: potionDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1a0516", "#3d0a33", "#701560", "#b0228f", "#f53cd1", "#ff86e6", "#ffd2f6", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(5)},
		},
	},
	New: newPotion,
}

Potion is a round glass flask of glowing brew rocking in the air: the brew sloshes behind the rock, bubbles rise and pop, light glows through the glass, wisps curl off the cork. It is registered as "pickups/potion".

var PowerStar = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Power star",
		Desc:     "A fat bevelled star rocks side to side and swells on each beat, rays of light turning slowly behind it, sparks spinning off its points.",
		Tags:     []string{"pickup", "star", "power-up", "invincible", "bonus", "loop"},
		Size:     [2]int{88, 84},
		Origin:   [2]int{44, 76},
		Duration: powerStarDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#2a1604", "#5e3208", "#a05c0c", "#e09414", "#ffc626", "#ffe866", "#fff8c4", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(9)},
		},
	},
	New: newPowerStar,
}

PowerStar is a fat bevelled star rocking side to side and swelling on each beat, rays of light turning slowly behind it, sparks spinning off its points. It is registered as "pickups/power-star".

var XPOrb = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "XP orb",
		Desc:     "A small glowing orb races a figure-eight, a comet tail tapering behind it along its path, flecks shed from the tail winking out, its light following it over the floor.",
		Tags:     []string{"pickup", "xp", "orb", "experience", "energy", "loop"},
		Size:     [2]int{72, 56},
		Origin:   [2]int{36, 48},
		Duration: xpOrbDuration,
		Loop:     true,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#0c1806", "#1e3a0a", "#36620e", "#5c9614", "#8cd024", "#c4f060", "#effcc0", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(2)},
		},
	},
	New: newXPOrb,
}

XPOrb is a small glowing orb racing a figure-eight, a comet tail tapering behind it along its path, flecks shed from the tail winking out, its light following it over the floor. It is registered as "pickups/xp-orb".