GitHubComeçar

A referência da API é gerada a partir dos comentários de documentação Go no código-fonte e está escrita em inglês.

package spawn

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

Visão geral

Package spawn is pixelfx's spawn and death category: coin drops, disintegration, dissolve burn, egg hatching, cartoon poofs, respawn beams, ice shatter deaths, rising souls, spawn portals and summoning rises, each a pixelfx.Effect registered as "spawn/<name>" when the package is imported.

Índice

Variáveis

var CoinDrop = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Coin drop",
		Desc:     "An enemy goes up in a soft poof and gold coins spin out of it, bounce with a glint on each hit, settle on the floor, twinkle, and wink out one by one.",
		Tags:     []string{"spawn", "death", "loot", "coins", "gold", "drop", "pickup", "ground", "one-shot"},
		Size:     [2]int{160, 88},
		Origin:   [2]int{80, 78},
		Duration: 3,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#2a1606", "#5c3208", "#9a5a0c", "#d48c14", "#f5b82a", "#ffe066", "#fff6c4", "#ffffff")},
			{Name: "smoke", Default: pixelfx.Palette("#3a3450", "#6c6688", "#a8a2c0", "#dcd8ea")},
			{Name: "coins", Default: pixelfx.Num(7)},
			{Name: "seed", Default: pixelfx.Num(23)},
		},
	},
	New: newCoinDrop,
}

CoinDrop is an enemy going up in a soft poof while gold coins spin out of it, bounce with a glint on each hit, settle on the floor, twinkle, and wink out one by one. It is registered as "spawn/coin-drop".

var Disintegrate = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Disintegrate",
		Desc:     "The character crackles with light, flashes white, then peels away from the head down: each pixel flares white-hot and streams off on the wind as a cooling mote of light.",
		Tags:     []string{"spawn", "death", "disintegrate", "dissolve", "pixels", "energy", "light", "one-shot"},
		Size:     [2]int{176, 100},
		Origin:   [2]int{48, 86},
		Duration: 3.4,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#120a26", "#2a1658", "#3d2f9c", "#3f68d4", "#3fa8ec", "#86e0ff", "#d6f8ff", "#ffffff")},
			{Name: "accent", Default: pixelfx.Palette("#7a3ae4", "#b682ff", "#ecd2ff")},
			{Name: "wind", Default: pixelfx.Num(1)},
			{Name: "seed", Default: pixelfx.Num(5)},
		},
	},
	Act: &pixelfx.Act{
		OnBody: true,
		Poses: []pixelfx.Key{
			{T: -0.2, Pose: pixelfx.Ready},
			{T: 0.05, Pose: pixelfx.Pose{}.With(pixelfx.Turn.Is(1), pixelfx.Crouch.Is(3), pixelfx.FX.Is(-9), pixelfx.FY.Is(-16), pixelfx.BX.Is(10), pixelfx.BY.Is(-16), pixelfx.FFX.Is(-3), pixelfx.FBX.Is(4))},
			{T: 0.3, Pose: disintegrateAgony},
			{T: 3.4, Pose: disintegrateAgony},
		},
	},
	ActorAlpha: func(t float64, _ *pixelfx.Options) float64 {
		if t < disintegrateFlash-0.1 {
			return 1
		}
		return 0
	},
	New: newDisintegrate,
}

Disintegrate crackles the character with light, flashes white, then peels it away from the head down: each pixel flares white-hot and streams off on the wind as a cooling mote of light. It is registered as "spawn/disintegrate".

var DissolveBurn = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Dissolve burn",
		Desc:     "An ember seam lights at the feet and climbs the body: above it the body scorches and smoulders, at it flames lick up, below it there's only falling ash, embers and smoke.",
		Tags:     []string{"spawn", "death", "burn", "fire", "ash", "dissolve", "embers", "one-shot"},
		Size:     [2]int{96, 112},
		Origin:   [2]int{48, 100},
		Duration: dissolveDuration,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#2a0e08", "#5a1a0c", "#a8320f", "#e8601a", "#ff9a2e", "#ffd25a", "#fff3c0", "#ffffff")},
			{Name: "ash", Default: pixelfx.Palette("#2a2428", "#4a4248", "#6e6670")},
			{Name: "seed", Default: pixelfx.Num(16)},
		},
	},
	Act: &pixelfx.Act{
		OnBody: true,
		Poses: []pixelfx.Key{
			{T: -0.16, Pose: pixelfx.Ready},
			{T: 0.4, Pose: pixelfx.Pose{}.With(pixelfx.Turn.Is(1), pixelfx.Crouch.Is(2), pixelfx.FX.Is(-9), pixelfx.FY.Is(-22), pixelfx.BX.Is(10), pixelfx.BY.Is(-22), pixelfx.FFX.Is(-3), pixelfx.FBX.Is(4))},
			{T: 0.8, Pose: dissolveWrithe},
			{T: 1.2, Pose: dissolveWrithe.With(pixelfx.Lean.Is(2), pixelfx.FY.Is(-26), pixelfx.BY.Is(-36))},
			{T: 1.6, Pose: dissolveWrithe.With(pixelfx.Lean.Is(-2), pixelfx.FY.Is(-36), pixelfx.BY.Is(-26))},
			{T: 2.1, Pose: dissolveWrithe.With(pixelfx.Crouch.Is(5), pixelfx.Lean.Is(2), pixelfx.FX.Is(-8), pixelfx.FY.Is(-38), pixelfx.BX.Is(9), pixelfx.BY.Is(-38))},
			{T: 3.6, Pose: dissolveWrithe.With(pixelfx.Crouch.Is(6), pixelfx.Lean.Is(2), pixelfx.FX.Is(-8), pixelfx.FY.Is(-36), pixelfx.BX.Is(9), pixelfx.BY.Is(-36))},
		},
	},
	ActorAlpha: func(float64, *pixelfx.Options) float64 { return 0 },
	New:        newDissolveBurn,
}

DissolveBurn lights an ember seam at the feet and climbs the body: above it the body scorches and smoulders, at it flames lick up, below it there's only falling ash, embers and smoke. It is registered as "spawn/dissolve-burn".

var EggHatch = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Egg hatch",
		Desc:     "A speckled egg rocks three times, each rock cracking it further with warm light leaking out, then pops: light pours out of the opening and lit shell halves tumble away.",
		Tags:     []string{"spawn", "egg", "hatch", "birth", "crack", "shell", "light", "ground", "one-shot"},
		Size:     [2]int{120, 96},
		Origin:   [2]int{60, 84},
		Duration: eggDuration,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1e1826", "#4a3e52", "#857684", "#c4b4ac", "#ece0d2", "#fffaf0")},
			{Name: "glow", Default: pixelfx.Palette("#ff8a2a", "#ffd25a", "#fff3c0")},
			{Name: "speckle", Default: pixelfx.Color("#9a6a52")},
			{Name: "seed", Default: pixelfx.Num(31)},
		},
	},
	New: newEggHatch,
}

EggHatch is a speckled egg rocking three times, each rock cracking it further with warm light leaking out, then popping: light pours out of the opening and lit shell halves tumble away. It is registered as "spawn/egg-hatch".

var Poof = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Poof",
		Desc:     "A cartoon death poof: a white pop, a ring of soft round smoke balls bursting out between speed lines, little stars spinning off, and the cloud lifting and thinning away.",
		Tags:     []string{"spawn", "death", "despawn", "smoke", "poof", "cartoon", "one-shot"},
		Size:     [2]int{112, 92},
		Origin:   [2]int{56, 80},
		Duration: 1.6,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#2a2440", "#5e5878", "#9a94b4", "#cdc8e0", "#f2f0fa", "#ffffff")},
			{Name: "stars", Default: pixelfx.Palette("#ffd84a", "#fff3a6", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(21)},
		},
	},
	New: newPoof,
}

Poof is a cartoon death poof: a white pop, a ring of soft round smoke balls bursting out between speed lines, little stars spinning off, and the cloud lifting and thinning away. It is registered as "spawn/poof".

var RespawnBeam = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Respawn beam",
		Desc:     "A guide line drops, a pillar of light slams onto the spot, and a scan bar climbs from the feet writing the character back in row by row, white-hot lines cooling to its colors.",
		Tags:     []string{"spawn", "respawn", "beam", "teleport", "scanline", "light", "one-shot"},
		Size:     [2]int{128, 150},
		Origin:   [2]int{64, 136},
		Duration: 2.5,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#061e1b", "#0c3e36", "#136a5a", "#1f9c80", "#45d1a8", "#a8f5d8", "#ffffff")},
			{Name: "width", Default: pixelfx.Num(15)},
			{Name: "seed", Default: pixelfx.Num(12)},
		},
	},
	Act: &pixelfx.Act{
		OnBody: true,
		Follow: pixelfx.Val(0),
		Poses: []pixelfx.Key{
			{T: 0, Pose: respawnSet},
			{T: 1.4, Pose: respawnSet},
			{T: 1.72, Pose: pixelfx.Pose{}.With(pixelfx.Turn.Is(1.15), pixelfx.Crouch.Is(-1), pixelfx.FX.Is(-13), pixelfx.FY.Is(-36), pixelfx.BX.Is(14), pixelfx.BY.Is(-36), pixelfx.HY.Is(-1), pixelfx.FFX.Is(-3), pixelfx.FBX.Is(4))},
			{T: 2.1, Pose: pixelfx.Ready},
			{T: 2.5, Pose: pixelfx.Ready},
		},
	},
	ActorAlpha: func(t float64, _ *pixelfx.Options) float64 {
		if t < respawnDone+0.04 {
			return 0
		}
		return 1
	},
	New: newRespawnBeam,
}

RespawnBeam drops a guide line, slams a pillar of light onto the spot, and climbs a scan bar from the feet writing the character back in row by row, white-hot lines cooling to its colors. It is registered as "spawn/respawn-beam".

var ShatterDeath = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Shatter death",
		Desc:     "Frost races up the body and seals it in faceted ice, a glint sweeps it, cracks spread from the chest, then it bursts into its own facets that tumble, bounce and melt.",
		Tags:     []string{"spawn", "death", "ice", "freeze", "shatter", "shards", "one-shot"},
		Size:     [2]int{172, 96},
		Origin:   [2]int{84, 84},
		Duration: shatterDuration,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#0e1636", "#1a2f66", "#2557a3", "#3488d6", "#5fc0f0", "#a2e6ff", "#dcf8ff", "#ffffff")},
			{Name: "seed", Default: pixelfx.Num(14)},
		},
	},
	Act: &pixelfx.Act{
		OnBody: true,
		Poses: []pixelfx.Key{
			{T: -0.2, Pose: pixelfx.Ready},
			{T: 0.08, Pose: shatterFear, How: "snap"},
			{T: 0.3, Pose: shatterFear.With(pixelfx.Lean.Is(-3), pixelfx.FY.Is(-34))},
			{T: 0.5, Pose: shatterFear},
			{T: 3.3, Pose: shatterFear},
		},
		Hits: []pixelfx.Hit{
			{T: 0.5, Stop: 0.02, Shake: 0.06, Amp: pixelfx.Val(1)},
			{T: 1.4, Stop: 0.09, Shake: 0.26, Amp: pixelfx.Val(3)},
		},
	},
	ActorAlpha: func(t float64, _ *pixelfx.Options) float64 {
		if t < shatterBurst {
			return 1
		}
		return 0
	},
	New: newShatterDeath,
}

ShatterDeath races frost up the body and seals it in faceted ice, sweeps a glint across it, spreads cracks from the chest, then bursts it into its own facets that tumble, bounce and melt. It is registered as "spawn/shatter-death".

var SoulRise = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Soul rise",
		Desc:     "The body's outline flares and dims, then a pale glowing copy of it lifts out, stretching as its legs melt into a rippling wisp, shedding motes until it thins into light.",
		Tags:     []string{"spawn", "death", "soul", "ghost", "spirit", "rise", "light", "one-shot"},
		Size:     [2]int{96, 140},
		Origin:   [2]int{48, 126},
		Duration: soulDuration,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#101a33", "#1f3563", "#35609e", "#5c96d4", "#94c8f0", "#d2f0ff", "#ffffff")},
			{Name: "height", Default: pixelfx.Num(50)},
			{Name: "seed", Default: pixelfx.Num(27)},
		},
	},
	Act: &pixelfx.Act{
		OnBody: true,
		Follow: pixelfx.Val(0),
		Poses: []pixelfx.Key{
			{T: -0.2, Pose: pixelfx.Ready},
			{T: 0.3, Pose: pixelfx.Pose{}.With(pixelfx.Turn.Is(1), pixelfx.Crouch.Is(2), pixelfx.HY.Is(-1), pixelfx.FX.Is(-10), pixelfx.FY.Is(-24), pixelfx.BX.Is(11), pixelfx.BY.Is(-24), pixelfx.FFX.Is(-3), pixelfx.FBX.Is(4))},
			{T: 0.7, Pose: pixelfx.Pose{}.With(pixelfx.Turn.Is(0.7), pixelfx.Crouch.Is(4), pixelfx.Lean.Is(3), pixelfx.HY.Is(1), pixelfx.FX.Is(2), pixelfx.FY.Is(-14), pixelfx.BX.Is(8), pixelfx.BY.Is(-14), pixelfx.FFX.Is(4), pixelfx.FBX.Is(-3))},
			{T: 1.1, Pose: soulSlump},
			{T: 2.7, Pose: soulSlump},
			{T: 3.2, Pose: soulSlump.With(pixelfx.Crouch.Is(7))},
		},
		Dust: []pixelfx.DustKick{{T: 1.1, X: 0, N: 5}},
	},
	ActorAlpha: func(float64, *pixelfx.Options) float64 { return 1 },
	New:        newSoulRise,
}

SoulRise flares and dims the body's outline, then lifts a pale glowing copy of it out, stretching as its legs melt into a rippling wisp, shedding motes until it thins into light. It is registered as "spawn/soul-rise".

var SpawnPortal = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Spawn portal",
		Desc:     "A rift tears open on the floor and swirls, belches violet smoke and sparks, spits a fountain of wisps up out of itself, then twists shut with a pop.",
		Tags:     []string{"spawn", "portal", "summon", "rift", "arcane", "smoke", "ground", "one-shot"},
		Size:     [2]int{208, 150},
		Origin:   [2]int{104, 122},
		Duration: 3.8,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#12081f", "#2a0f4d", "#481b8c", "#7330d0", "#a35cff", "#cf9bff", "#f1dcff", "#ffffff")},
			{Name: "width", Default: pixelfx.Num(28)},
			{Name: "seed", Default: pixelfx.Num(6)},
		},
	},
	New: newSpawnPortal,
}

SpawnPortal tears a rift open on the floor and swirls, belches violet smoke and sparks, spits a fountain of wisps up out of itself, then twists shut with a pop. It is registered as "spawn/spawn-portal".

var SummonRise = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Summon rise",
		Desc:     "A rune circle burns into the floor, the ground bursts, and a horned brute heaves up out of it through dust and rubble, lit from below, until its eyes flare.",
		Tags:     []string{"spawn", "summon", "demon", "rise", "runes", "dust", "rubble", "ground", "one-shot"},
		Size:     [2]int{176, 116},
		Origin:   [2]int{88, 94},
		Duration: summonDuration,
		Loop:     false,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1a0608", "#3d0c0c", "#7a1a10", "#c0381a", "#f06a1e", "#ffae3a", "#ffe08a", "#ffffff")},
			{Name: "body", Default: pixelfx.Palette("#060409", "#0e0913", "#170f1e", "#211628", "#2d2036")},
			{Name: "horn", Default: pixelfx.Palette("#0c080c", "#201820", "#352a32", "#4e3f48", "#6e5c64")},
			{Name: "stone", Default: pixelfx.Palette("#1a1424", "#2b2639", "#4a4263", "#6c6488", "#9a91b4")},
			{Name: "seed", Default: pixelfx.Num(9)},
		},
	},
	New: newSummonRise,
}

SummonRise burns a rune circle into the floor, bursts the ground, and heaves a horned brute up out of it through dust and rubble, lit from below, until its eyes flare. It is registered as "spawn/summon-rise".