GitHubНачать

Справочник API собран из Go doc-комментариев в исходном коде и написан на английском языке.

package impacts

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

Обзор

Package impacts is pixelfx's impacts category: blunt hits, bullet impacts, critical hits, ground slams, heavy landings, hit flashes, hit sparks, anime impact frames, parries, ricochets and shield blocks, each a pixelfx.Effect registered as "impacts/<name>" when the package is imported.

Указатель

Переменные

var BluntHit = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Blunt hit",
		Desc:     "A heavy, soft thud: a white-hot lumpy blob cools to cream in a warm pool of light, inked wedges jab out and snap back, a squashed ring of dust puffs swells and drifts, clods drop.",
		Tags:     []string{"impact", "hit", "blunt", "punch", "club", "thump", "dust", "comic", "one-shot"},
		Size:     [2]int{128, 88},
		Origin:   [2]int{64, 72},
		Duration: 0.9,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1d1620", "#4a3a3c", "#7d6a66", "#b09c90", "#dccab4", "#f6ead2", "#ffffff")},
			{Name: "warm", Default: pixelfx.Color("#ffc98a")},
			{Name: "dust", Default: pixelfx.Color("#b7a8a6")},
			{Name: "clod", Default: pixelfx.Color("#6e5a5a")},
			{Name: "height", Default: pixelfx.Num(22)},
			{Name: "seed", Default: pixelfx.Num(9)},
		},
	},
	New: newBluntHit,
}

BluntHit is a heavy, soft thud: a white-hot lumpy blob cools to cream in a warm pool of light, inked wedges jab out and snap back, a squashed ring of dust puffs swells and drifts, clods drop. It is registered as "impacts/blunt-hit".

var BulletImpact = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Bullet impact",
		Desc:     "A bullet hits a wall on the right: a hot half-star, sparks sprayed back in a cone, a puff of grit, chips that fall and bounce, a pock mark cooling to soot.",
		Tags:     []string{"impact", "bullet", "gun", "wall", "sparks", "debris", "directional", "one-shot"},
		Size:     [2]int{152, 100},
		Origin:   [2]int{116, 84},
		Duration: bulletDuration,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#4a1712", "#c9281f", "#f2561d", "#ff8a2a", "#ffe26b", "#fff3a6", "#ffffff")},
			{Name: "stone", Default: pixelfx.Color("#5b5079")},
			{Name: "height", Default: pixelfx.Num(24)},
			{Name: "seed", Default: pixelfx.Num(6)},
		},
	},
	New: newBulletImpact,
}

BulletImpact is a bullet hitting a wall on the right: a hot half-star, sparks sprayed back in a cone, a puff of grit, chips that fall and bounce, a pock mark cooling to soot. It is registered as "impacts/bullet-impact".

var CritHit = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Critical hit",
		Desc:     "A critical hit: a jagged starburst slams in white and overshoots, a ring breaks into flying arcs, sparks streak off, shards tumble to the floor under a big flare.",
		Tags:     []string{"impact", "hit", "crit", "critical", "combat", "directional", "one-shot"},
		Size:     [2]int{216, 136},
		Origin:   [2]int{84, 106},
		Duration: 0.9,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#2a0510", "#5c0a1c", "#a3142a", "#e0302c", "#ff7a2a", "#ffc23d", "#fff09a", "#ffffff")},
			{Name: "height", Default: pixelfx.Num(26)},
			{Name: "aim", Default: pixelfx.Num(0.12)},
			{Name: "seed", Default: pixelfx.Num(3)},
		},
	},
	New: newCritHit,
}

CritHit is a critical hit: a jagged starburst slams in white and overshoots, a ring breaks into flying arcs, sparks streak off, shards tumble to the floor under a big flare. It is registered as "impacts/crit-hit".

var GroundSlam = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Ground slam",
		Desc:     "Something lands hard: the floor flashes and cracks, two crescent shock waves race out along it, a dust wave and a tall dust cloud rise, rocks erupt, bounce and settle.",
		Tags:     []string{"impact", "ground", "slam", "shockwave", "quake", "rocks", "dust", "one-shot"},
		Size:     [2]int{288, 208},
		Origin:   [2]int{144, 164},
		Duration: slamDuration,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#2a1712", "#5e2c1c", "#a4502a", "#e8893a", "#ffc764", "#fff0b4", "#ffffff")},
			{Name: "stone", Default: pixelfx.Color("#4a3f69")},
			{Name: "reach", Default: pixelfx.Num(104)},
			{Name: "seed", Default: pixelfx.Num(5)},
		},
	},
	New: newGroundSlam,
}

GroundSlam is something landing hard: the floor flashes and cracks, two crescent shock waves race out along it, a dust wave and a tall dust cloud rise, rocks erupt, bounce and settle. It is registered as "impacts/ground-slam".

var HeavyLanding = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Heavy landing",
		Desc:     "A character lands hard: the floor dents and cracks under their feet, two rings of dust roll out along the floor one after the other, and pebbles hop away.",
		Tags:     []string{"impact", "landing", "ground", "stomp", "dust", "rocks", "actor", "one-shot"},
		Size:     [2]int{176, 80},
		Origin:   [2]int{88, 60},
		Duration: landingDuration,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#1c1a24", "#2f2a3a", "#4a4258", "#6b6280", "#9088a4", "#bdb6cc", "#e6e1ee")},
			{Name: "stone", Default: pixelfx.Color("#4a3f69")},
			{Name: "seed", Default: pixelfx.Num(14)},
		},
	},
	Act: &pixelfx.Act{
		Poses: []pixelfx.Key{
			{T: -0.26, Pose: landingFall},
			{T: -0.01, Pose: landingFall.With(pixelfx.Y.Is(-6)), How: "in"},
			{T: 0, Pose: landingHero, How: "snap"},
			{T: 0.55, Pose: landingHero.With(pixelfx.Crouch.Is(7))},
			{T: 0.95, Pose: landingHero.With(pixelfx.Crouch.Is(5), pixelfx.Lean.Is(3), pixelfx.FX.Is(13), pixelfx.FY.Is(-15), pixelfx.BX.Is(-5), pixelfx.BY.Is(-20))},
			{T: 1.3, Pose: pixelfx.Ready},
			{T: 1.6, Pose: pixelfx.Ready},
		},
		Hits: []pixelfx.Hit{{T: 0.005, Stop: 0.13, Shake: 0.32, Amp: pixelfx.Val(3)}},
	},
	New: newHeavyLanding,
}

HeavyLanding is a character landing hard: the floor dents and cracks under their feet, two rings of dust roll out along the floor one after the other, and pebbles hop away. It is registered as "impacts/heavy-landing".

var HitFlash = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Hit flash",
		Desc:     "The character takes damage: a white frame, then their own colors flushed red and blinking white, cooling off, while comic hit lines jab in at them.",
		Tags:     []string{"impact", "hit", "damage", "hurt", "flash", "blink", "actor", "comic", "one-shot"},
		Size:     [2]int{80, 64},
		Origin:   [2]int{40, 54},
		Duration: 0.5,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#14040a", "#3a0a14", "#6a101c", "#a01824", "#d42a30", "#ff5a50", "#ff9a8a")},
			{Name: "lines", Default: pixelfx.Num(7)},
			{Name: "side", Default: pixelfx.Num(1)},
			{Name: "seed", Default: pixelfx.Num(17)},
		},
	},
	Act: &pixelfx.Act{
		OnBody: true,
		Poses: []pixelfx.Key{
			{T: -0.26, Pose: pixelfx.Ready.With(pixelfx.X.Is(0))},
			{T: 0, Pose: hitFlashBlown, How: "snap"},
			{T: 0.16, Pose: hitFlashBlown.With(pixelfx.X.Is(-8), pixelfx.Crouch.Is(5))},
			{T: 0.42, Pose: hitFlashBlown.With(pixelfx.X.Is(-8), pixelfx.Crouch.Is(5), pixelfx.Lean.Is(-2), pixelfx.FX.Is(9), pixelfx.FY.Is(-22), pixelfx.BX.Is(6), pixelfx.BY.Is(-20), pixelfx.FFY.Is(-4))},
			{T: 0.86, Pose: pixelfx.Ready.With(pixelfx.X.Is(0))},
		},
		Hits: []pixelfx.Hit{{T: 0, Stop: 0.07, Shake: 0.14, Amp: pixelfx.Val(2)}},
	},
	New: newHitFlash,
}

HitFlash is the character taking damage: a white frame, then their own colors flushed red and blinking white, cooling off, while comic hit lines jab in at them. It is registered as "impacts/hit-flash".

var HitSpark = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Hit spark",
		Desc:     "The everyday hit: a sharp, lopsided cross flare with one long ray along the blow round a white diamond core, then a cone of sparks and hot chips that fall and bounce.",
		Tags:     []string{"impact", "hit", "spark", "combat", "directional", "one-shot"},
		Size:     [2]int{136, 80},
		Origin:   [2]int{44, 64},
		Duration: 0.5,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#4a1712", "#c9281f", "#f2561d", "#ff8a2a", "#ffe26b", "#fff3a6", "#ffffff")},
			{Name: "height", Default: pixelfx.Num(20)},
			{Name: "aim", Default: pixelfx.Num(0.1)},
			{Name: "seed", Default: pixelfx.Num(4)},
		},
	},
	New: newHitSpark,
}

HitSpark is the everyday hit: a sharp, lopsided cross flare with one long ray along the blow round a white diamond core, then a cone of sparks and hot chips that fall and bounce. It is registered as "impacts/hit-spark".

var ImpactFrame = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Impact frame",
		Desc:     "An anime impact: two frames of white with black burst lines rushing at the hit, two frames inverted, then the lines pull out past the edges and vanish.",
		Tags:     []string{"impact", "hit", "anime", "manga", "flash", "speed-lines", "screen", "one-shot"},
		Size:     [2]int{impactW, impactH},
		Origin:   [2]int{impactOX, impactOY},
		Duration: 0.3,
		FPS:      30,
		BG:       "black",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#000000", "#ffffff")},
			{Name: "lines", Default: pixelfx.Num(64)},
			{Name: "seed", Default: pixelfx.Num(19)},
		},
	},
	New: newImpactFrame,
}

ImpactFrame is an anime impact: two frames of white with black burst lines rushing at the hit, two frames inverted, then the lines pull out past the edges and vanish. It is registered as "impacts/impact-frame".

var Parry = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Parry",
		Desc:     "Two blades clash: their edges flash in an X, a white four-point star rings out, a ring breaks into arcs and a fan of gold sparks sprays up and rains down.",
		Tags:     []string{"impact", "parry", "block", "clash", "sword", "metal", "sparks", "one-shot"},
		Size:     [2]int{200, 112},
		Origin:   [2]int{100, 96},
		Duration: 1,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#2a1a08", "#6a4410", "#b07a1a", "#e8b030", "#ffe066", "#fff6c4", "#ffffff")},
			{Name: "height", Default: pixelfx.Num(30)},
			{Name: "seed", Default: pixelfx.Num(11)},
		},
	},
	New: newParry,
}

Parry is two blades clashing: their edges flash in an X, a white four-point star rings out, a ring breaks into arcs and a fan of gold sparks sprays up and rains down. It is registered as "impacts/parry".

var Ricochet = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Ricochet",
		Desc:     "A tracer streaks down onto the floor, glances off with a white-hot star and skips away at an angle, leaving a glowing skid while sparks skitter along the ground.",
		Tags:     []string{"impact", "ricochet", "bullet", "tracer", "sparks", "ground", "directional", "one-shot"},
		Size:     [2]int{232, 84},
		Origin:   [2]int{64, 60},
		Duration: ricochetDuration,
		FPS:      30,
		BG:       "ground",
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#4a1712", "#c9281f", "#f2561d", "#ff8a2a", "#ffe26b", "#fff3a6", "#ffffff")},
			{Name: "stone", Default: pixelfx.Color("#5b5079")},
			{Name: "seed", Default: pixelfx.Num(8)},
		},
	},
	New: newRicochet,
}

Ricochet is a tracer streaking down onto the floor, glancing off with a white-hot star and skipping away at an angle, leaving a glowing skid while sparks skitter along the ground. It is registered as "impacts/ricochet".

var ShieldBlock = &pixelfx.Effect{
	Meta: pixelfx.Meta{
		Name:     "Shield block",
		Desc:     "A blow is caught on a half-dome of energy in front of the character: its diamond lattice flashes, a ripple runs over it, sparks glance off, then it blinks out cell by cell.",
		Tags:     []string{"impact", "block", "shield", "barrier", "energy", "ripple", "actor", "one-shot"},
		Size:     [2]int{148, 104},
		Origin:   [2]int{40, 88},
		Duration: 1.1,
		FPS:      30,
		BG:       "ground",
		Actor:    2,
		Options: []pixelfx.Option{
			{Name: "palette", Default: pixelfx.Palette("#151a3d", "#212f6b", "#2c58aa", "#3a8bd8", "#62c8f4", "#a6ecff", "#dcfbff", "#ffffff")},
			{Name: "sparks", Default: pixelfx.Palette("#fff3a6", "#ffe26b", "#ff8a2a", "#f2561d")},
			{Name: "seed", Default: pixelfx.Num(12)},
		},
	},
	Act: &pixelfx.Act{
		Poses: []pixelfx.Key{
			{T: -0.36, Pose: pixelfx.Ready},
			{T: -0.1, Pose: shieldBrace},
			{T: 0, Pose: shieldBrace.With(pixelfx.X.Is(-3), pixelfx.Crouch.Is(6), pixelfx.Lean.Is(-2), pixelfx.FX.Is(10), pixelfx.FY.Is(-26)), How: "snap"},
			{T: 0.18, Pose: shieldBrace.With(pixelfx.X.Is(-4), pixelfx.Crouch.Is(5), pixelfx.Lean.Is(0))},
			{T: 0.65, Pose: shieldBrace.With(pixelfx.X.Is(-3))},
			{T: 1.1, Pose: pixelfx.Ready.With(pixelfx.X.Is(0))},
		},
		Hits: []pixelfx.Hit{{T: 0.005, Stop: 0.09, Shake: 0.2, Amp: pixelfx.Val(2)}},
		Dust: []pixelfx.DustKick{{T: 0.01, X: -10, N: 6, Dir: -1}},
	},
	New: newShieldBlock,
}

ShieldBlock is a blow caught on a half-dome of energy in front of the character: its diamond lattice flashes, a ripple runs over it, sparks glance off, then it blinks out cell by cell. It is registered as "impacts/shield-block".