Files

44 lines
1.9 KiB
Lua

local Yokai = require("background/bg_objects/yokai")
local Timing = require("background/bg_objects/timing")
local steps = Timing.steps
local enter, leave, squash = Yokai.enter, Yokai.leave, Yokai.squash
-- Dancers: the Yo-kai Watch set in festival clothes, dancing a 4-beat routine of half-beat
-- poses, a whole-beat stretch up on their toes and a whole-beat pose. Poses are offsets of
-- their feet (texture.json y 686).
local ORIGIN = { 128, 312 }
local function stretch(frame) return squash(frame, 1.05, 0.425, 0.15, 0.425) end
local function routine(a, b, c, d, e)
return steps({ { a, 0.5, x = 0, y = 0 }, { b, 0.5 }, { a, 0.5 }, { c, 0.5 } }, { stretch(d) }, { { e, 1 } })
end
-- Whisper: arm outlines (under) and fills (over) follow the routine around his body loop
local function arms(key)
local layer = steps({ { 0, 0.5, x = 0, y = 0 }, { 1, 0.5 }, { 0, 0.5 }, { 2, 0.5 }, { 3, 1 }, { 4, 1 } })
layer.key = key
return layer
end
local WHISPER_BODY = Yokai.cycle(4, 2, "loop")
for _, p in ipairs(WHISPER_BODY) do p[4] = -156 end
WHISPER_BODY.origin = { 128, 156 }
return Yokai.background("background/collab/yokai_matsuri", {
-- Komasan: a pose a half beat longer, then the stretch
[0] = {
origin = ORIGIN, enter = enter(0), leave = leave(0),
dance = steps({ { 1, 0.5, x = 0, y = 0 }, { 2, 0.5 }, { 3, 0.5 }, { 2, 0.5 }, { 4, 0.5 } },
{ stretch(5) }, { { 1, 0.5 } }),
},
[1] = {
origin = ORIGIN, enter = enter(1), leave = leave(10),
dance = { beats = 4, move = Yokai.bob(4), arms("_arms"), WHISPER_BODY, arms("_hands") },
},
[2] = { origin = ORIGIN, enter = enter(1), leave = leave(7), dance = routine(2, 3, 4, 5, 6) },
[3] = { origin = ORIGIN, enter = enter(1), leave = leave(7), dance = routine(2, 3, 4, 5, 6) },
-- Jibanyan, centre: never removed
[4] = { origin = ORIGIN, enter = enter(0), dance = routine(1, 2, 3, 4, 5) },
})