Cookbook¶
Small recipes to steal. Each one is complete and tested: put it in a file under a format 2.0 line and an
event { name = "..." }, and it works - a .event file, or a .modchart file for the Lanes ones. Recipes that need a chart event use onEvent; the others are
song scripts that run for the whole song.
Click one open, copy it, change the numbers until it feels right. That's really all there is to it.
Camera and HUD¶
A slow zoom that stays
params {
zoom = number { from = "value1", default = 1.15, min = 0.5, max = 2, step = 0.05 },
length = number { from = "value2", default = 4, min = 0, max = 32, step = 0.5, label = "Beats" },
}
function onEvent(p)
tween(camera.zoom, p.zoom, beats(p.length), "sineInOut")
end
The shortcut for the same: zoom(p.zoom, beats(p.length)).
Shake on a hard hit
Or with the shortcut: shake(0.012, beats(1)).
The playfield rocks with the beat
Flashes and colours¶
Red flash on a miss
Cut to black and back
params {
hold = number { from = "value1", default = 2, min = 0, max = 16, step = 0.5, label = "Beats black" },
}
function onEvent(p)
screen.color = #000000
screen.alpha = 1
after(beats(p.hold), function()
tween(screen.alpha, 0, beats(1))
end)
end
With the shortcuts: fadeOut(#000000, 0), then fadeIn(beats(1)) in the after.
A title card on the chart event (uses onEvent)
The world goes dark for a part (fights, uses onSection)
A gold path builds up beat by beat (fights, uses onBeat)
Your structure behind the opponent, turning in the drop (fights, uses onStart and onSection)
A wall fades in for the last part (fights, uses onStart and onSection)
A crowd that jumps on every beat (fights, uses onStart and onBeat)
A creeper walks up to the opponent and explodes (fights, uses onSection)
A pig walks back and forth (fights, uses onStart and onBeat)
Fire everyone around can see for the drop (fights, uses onSection)
A storm comes up for the drop (fights, uses onSection)
Snow and fog for a quiet part (fights, uses onSection)
Lightning on every Sick of the opponent (fights, uses onOpponentHit)
The world turns red at low health (fights, uses onFrame)
Only the two fighters for the chorus (fights, uses onSection)
Strum background in the colour of the last judgment
Text¶
A line of lyrics that fades in and out
params {
line = text { from = "value1", label = "Line" },
length = number { from = "value2", default = 4, min = 1, max = 16, step = 1, label = "Beats" },
}
local shown = 0
function onEvent(p)
shown += 1
local mine = shown
text[7].value = p.line ?? ""
text[7].y = 0.82
text[7].alpha = 0
tween(text[7].alpha, 1, beats(0.25))
after(beats(p.length), function()
if shown == mine then tween(text[7].alpha, 0, beats(0.5)) end
end)
end
The counter makes sure a newer line isn't faded out by an older one's timer.
Live accuracy in a corner
Combo shout every 50
local next = 50
function onHit(note)
if player.combo >= next then
text[4].value = next .. " COMBO!"
text[4].y = 0.6
text[4].size = 1.6
text[4].alpha = 1
tween(text[4].size, 1.1, beats(0.5), "backOut")
tween(text[4].alpha, 0, beats(1.5), "quadIn")
next += 50
end
end
function onMiss(note)
next = 50
end
Lanes¶
These go in a .modchart file (why).
Lanes light up when they're pressed
The opponent's notes shake your lanes
Slow down, then speed up
More in Modcharts and strum[lane].
Fighters (fights only)¶
Hearts on every Sick (uses onHit)
Fire around the opponent on every beat (uses onBeat)
The opponent catches fire for the drop (fights, uses onSection)
A knight's look for the opponent (fights, uses onStart)
You glow in the dark part (fights, uses onSection)
Both fighters bounce on every beat
The opponent flinches when you hit a sick
The opponent turns red as your combo grows
A new mob every 8 beats (against the dummy)
The dummy turns into a skeleton for the drop, then comes back
Plain skins for this song (Figura avatars off)
More in The fighters.
Sprite characters¶
A dancing GF that cheers every 25 notes (uses onStart)
function onStart()
character[2].file = "characters/gf.png" -- + gf.xml next to it
character[2].x = 0.5
character[2].y = 0.8
character[2].cheerEvery = 25
characterPose(2, "danceLeft", "GF Dancing Beat", 0, -9, "30, 0-14")
characterPose(2, "danceRight", "GF Dancing Beat", 0, -9, "15-29")
characterPose(2, "cheer", "GF Cheer")
end
The opponent sprite jumps on the drop (uses onSection)
Sound¶
A Minecraft bell on every fourth beat (uses onBeat)
A sound on the drop
The opponent's voice drops out for a bar
The game window¶
More in Game window and pop-outs.
The window shakes on every miss
The judgments in a window of their own, floating above the game
Each lane flies out into its own window and circles the screen
local circling = false
function onEvent(p)
popout[0].show = "left"
popout[1].show = "down"
popout[2].show = "up"
popout[3].show = "right"
circling = true
after(beats(16), function()
circling = false
resetWindow(beats(2)) -- glide home, then close
end)
end
function onFrame(dt)
if not circling then return end
for i = 0, 3 do
local a = time / 1000 + i * pi / 2
popout[i].x = cos(a) * 300
popout[i].y = sin(a) * 150
end
end