-
Notifications
You must be signed in to change notification settings - Fork 7
Custom Spinner Trigger
There are multiple triggers in Frost Helper affecting Custom Spinners:
-
The
Change SpinnersTrigger allows dynamically changing the properties of Custom Spinners. -
The
Shatter Custom SpinnersTrigger allows shattering Custom Spinners.
All of these triggers are known as Spinner Triggers and follow simillar rules.
Make sure to understand Session Expressions first.
Leave Filter and Cache Filter empty to affect all spinners in the room at once.
Inside this trigger, additional Session Expression Commands can be used (Keep in mind the expression is evaluated for each spinner separately.)
-
$directory-string- The directory the spinner currently takes its sprites from. -
$origDirectory-string- Like$directory, but takes into account only the directory set in the map editor, ignoring the effects of the Change Spinners Trigger. -
$attachGroup-int- The Attach Group setting of the spinner. -
$playerDist-float- The distance of the spinner from the player. -
$animFrame-int- For animated spinners, their current animation frame. -
$playerCollides-bool- Whether the player is currently colliding with the spinner, even if it is uncollidable.
A session expression, which gets evaluated each time the trigger is activated, for each spinner separately.
-
$origDirectory=="danger/spinners/Spooooky/AssetPack/vanillaish>_whitepure"- Only targets spinners which were set todanger/spinners/Spooooky/AssetPack/vanillaish>_whitepurein the map editor. -
$playerDist < 32- Only targets spinners close to the player, could be used to play an animation when the player approaches a spinner. (Keep in mind that you'll need to regularly activate this trigger, with something like a Loop Activator, for this behavior to work.)
If you're activating these triggers frequently, they might become laggy in rooms with lots of spinners, especially if a filter is used.
In such cases, it's best to move as much work as possible to the Cache Filter - it only gets executed once for each spinner on room load, and only spinners that matched the Cache Filter will later be considered by the trigger and the Filter.
For example, if you're using a Filter like $origDirectory=="someDirectory" && $playerDist < 32 to change the sprite of spinners close to the player, it is wasteful to perform the $origDirectory=="someDirectory" check each time - its result can never change for any given spinner.
Instead, using Cache Filter: $origDirectory=="someDirectory" and Filter: $playerDist < 32 will be more lag-friendly.
Spinner Triggers support adding a node, which can point at another Spinner Trigger.
That second trigger will get activated for each spinner changed by the current trigger, optionally after a delay set by the Next Trigger Delay property.
Note
This mechanic is implemented into Frost Helper directly (set Dash Through to Shatter), this is just an example of implementing gameplay mechanics via these triggers.
- The spinner has to have the
Dash Throughproperty set toPassThrough, to not kill the player when dashing into it. - The
On Player Dashing Activator, withOnly when Just Dasheddisabled, will activate aShatter Spinnerstrigger each frame the player is dashing. - The
Shatter Spinnerstrigger, withCache Filter: $directory=="danger/spinners/Spooooky/AssetPack/vines>_red"andFilter: $playerCollideswill shatter the spinners that the player is colliding with.
Copyable setup
{
{
_editorLayer = 0,
_fromLayer = "triggers",
_id = 3558,
_name = "FrostHelper/ShatterSpinnersTrigger",
_type = "trigger",
cacheFilter = "$directory==\"danger/spinners/Spooooky/AssetPack/vines>_red\"",
filter = "$playerCollides",
height = 24,
width = 32,
x = 384,
y = 256
},
{
_editorLayer = 0,
_fromLayer = "triggers",
_id = 3559,
_name = "FrostHelper/OnPlayerDashingActivator",
_type = "trigger",
activationMode = "AllOrdered",
delay = "0",
hasToBeInside = false,
height = 24,
nodes = {
{
x = 392,
y = 264
}
},
once = false,
onlyWhenJustDashed = false,
width = 32,
x = 328,
y = 256
}
}
Spinner:
{
{
_editorLayer = 0,
_fromLayer = "entities",
_id = 3560,
_name = "FrostHelper/IceSpinner",
attachGroup = -1,
attachToSolid = false,
bloomAlpha = 0,
bloomRadius = 0,
borderColor = "000000",
collidable = true,
dashThrough = "PassThrough",
debrisCount = 8,
depth = -8500,
destroyColor = "b0eaff",
directory = "danger/spinners/Spooooky/AssetPack/vines>_red",
drawOutline = true,
hitbox = "C,6,0,0;R,16,4,-8,-3",
imageScale = 1,
onHoldable = "PassThrough",
rainbow = false,
scale = 1,
singleFGImage = false,
tint = "ffffff",
x = 184,
y = 240
}
}
- Loop Activator with
Loop Time: 0updates the mechanic each frame, points atChange Spinners trigger #1. -
Change Spinners trigger #1usesFilter: $playerDist < 32andNew Rainbow: True, and has a node pointing atChange Spinners trigger #2and hasNext Trigger Delay: 0.01to delay activating #2 until next frame. -
Change Spinners trigger #2usesFilter: $playerDist >= 32, and hasNew Rainbow: False.
Copyable setup
{
{
_editorLayer = 0,
_fromLayer = "triggers",
_id = 3566,
_name = "FrostHelper/LoopActivator",
activateAfterDeath = false,
activationMode = "AllOrdered",
delay = "0",
height = 16,
loopTime = 0,
nodes = {
{
x = 464,
y = 240
}
},
requireActivation = false,
width = 32,
x = 448,
y = 208
},
{
_editorLayer = 0,
_fromLayer = "triggers",
_id = 3555,
_name = "FrostHelper/ChangeSpinnersTrigger",
_type = "trigger",
animationBehavior = "LeaveUnchanged",
cacheFilter = "$origDirectory==\"danger/spinners/Spooooky/AssetPack/vanillaish>_whitepure\"",
filter = "$playerDist < 32",
height = 16,
newBorderColor = "",
newCollidable = "LeaveUnchanged",
newDashThrough = "LeaveUnchanged",
newDepth = "",
newDirectory = "",
newOnHoldable = "LeaveUnchanged",
newRainbow = "True",
newTint = "",
nextTriggerDelay = 0.01,
nodes = {
{
x = 464,
y = 264
}
},
oncePerSpinner = false,
width = 32,
x = 448,
y = 232
},
{
_editorLayer = 0,
_fromLayer = "triggers",
_id = 3565,
_name = "FrostHelper/ChangeSpinnersTrigger",
_type = "trigger",
animationBehavior = "LeaveUnchanged",
cacheFilter = "",
filter = "$playerDist >= 32",
height = 16,
newBorderColor = "",
newCollidable = "LeaveUnchanged",
newDashThrough = "LeaveUnchanged",
newDepth = "",
newDirectory = "",
newOnHoldable = "LeaveUnchanged",
newRainbow = "False",
newTint = "",
nextTriggerDelay = 0,
nodes = {
},
oncePerSpinner = false,
width = 32,
x = 448,
y = 256
}
}
Spinner:
{
{
_editorLayer = 0,
_fromLayer = "entities",
_id = 3563,
_name = "FrostHelper/IceSpinner",
attachGroup = -1,
attachToSolid = false,
bloomAlpha = 0,
bloomRadius = 0,
borderColor = "000000",
collidable = true,
dashThrough = "PassThrough",
debrisCount = 8,
depth = -8500,
destroyColor = "b0eaff",
directory = "danger/spinners/Spooooky/AssetPack/vanillaish>_whitepure",
drawOutline = true,
hitbox = "C,6,0,0;R,16,4,-8,-3",
imageScale = 1,
onHoldable = "PassThrough",
rainbow = false,
scale = 1,
singleFGImage = false,
tint = "ffffff",
x = 160,
y = 264
}
}