55 lines
2.4 KiB
Lua
55 lines
2.4 KiB
Lua
local Yokai = require("background/bg_objects/yokai")
|
|
local Timing = require("background/bg_objects/timing")
|
|
|
|
local steps = Timing.steps
|
|
local enter, leave = Yokai.enter, Yokai.leave
|
|
|
|
-- Dancers: five yo-kai and kids dance an 8-beat routine of half- and whole-beat poses. Poses are
|
|
-- offsets of their feet (texture.json y 686), the pivot for the squash.
|
|
local ORIGIN = { 128, 312 }
|
|
|
|
-- the routine most of them share, poses a..e; `last` adds fields to the e pose
|
|
local function routine(a, b, c, d, e, last)
|
|
local e_step = { e, 1 }
|
|
for k, v in pairs(last or {}) do e_step[k] = v end
|
|
return steps({ { a, 0.5, x = 0, y = 0 }, { b, 0.5 }, { a, 0.5 }, { c, 0.5 }, { d, 1 }, { b, 0.5 },
|
|
{ a, 1 }, { b, 0.5 }, { a, 0.5 }, { c, 0.5 }, e_step, { b, 1, x = 0 } })
|
|
end
|
|
|
|
-- Whisper floats: his body (8 frames a quarter beat each) leans 5 degrees on the d and e poses,
|
|
-- between arm outlines (under) and arm fills (over) that follow the routine
|
|
local function whisper_body()
|
|
local poses = { length = 8 }
|
|
for i = 0, 31 do
|
|
local beat = i * 0.25
|
|
local rot = (beat >= 2 and beat < 3) and 5 or (beat >= 6 and beat < 7) and -5 or 0
|
|
poses[#poses + 1] = { beat, 2 + i % 8, 0, -156, rot = rot }
|
|
end
|
|
return poses
|
|
end
|
|
|
|
local WHISPER_DANCE = {
|
|
beats = 8, move = Yokai.bob(8),
|
|
routine(0, 1, 2, 3, 4, { x = -6 }), -- arm outlines
|
|
whisper_body(),
|
|
routine(0, 1, 2, 3, 3, { mirror = true }), -- arm fills
|
|
}
|
|
WHISPER_DANCE[1].key, WHISPER_DANCE[2].key, WHISPER_DANCE[3].key = "_arms", "loop", "_hands"
|
|
WHISPER_DANCE[2].origin = { 128, 156 }
|
|
|
|
return Yokai.background("background/collab/yokai", {
|
|
-- Komasan, far right: a routine of his own
|
|
[0] = {
|
|
origin = ORIGIN, enter = enter(0), leave = leave(0),
|
|
dance = steps({ { 1, 0.5, x = 0, y = 0 }, { 2, 0.5 }, { 1, 0.5 }, { 2, 0.5 }, { 0, 0.5 }, { 3, 1 },
|
|
{ 1, 0.5 }, { 2, 1 }, { 1, 0.5 }, { 2, 0.5 }, { 0, 0.5 }, { 4, 1 }, { 0, 0.5 } }),
|
|
},
|
|
-- Whisper, far left
|
|
[1] = { origin = ORIGIN, enter = enter(1), leave = leave(10), dance = WHISPER_DANCE },
|
|
-- Fumika, right, and Keita, left
|
|
[2] = { origin = ORIGIN, enter = enter(1), leave = leave(6), dance = routine(2, 0, 3, 4, 5) },
|
|
[3] = { origin = ORIGIN, enter = enter(1), leave = leave(6), dance = routine(2, 0, 3, 4, 5) },
|
|
-- Jibanyan, centre: Lumen has no exit for him (he is never removed)
|
|
[4] = { origin = ORIGIN, enter = enter(0), dance = routine(1, 2, 3, 4, 5) },
|
|
})
|