70 lines
3.0 KiB
Lua
70 lines
3.0 KiB
Lua
local Mh3 = require("background/bg_objects/mh3")
|
|
local Timing = require("background/bg_objects/timing")
|
|
|
|
local pose_at = Timing.pose_at
|
|
|
|
-- Monster Hunter Portable 3rd (see bg_objects/mh3.lua for the parts it shares with 3G)
|
|
|
|
-- Fever: just after the rainbow, a Rathalos (drawn 1.6x) runs left across the stage, back
|
|
-- right, sets off left again but stumbles, skids along on its belly, gets up and runs off,
|
|
-- and comes back right once more; 36 beats a loop, its legs four frames a stride. Losing the
|
|
-- rainbow fades it out over a beat. Timed in beats; x, y are its centre from where the run is
|
|
-- anchored.
|
|
local FEVER_AT = { 640, 619 }
|
|
local SCALE = 1.6
|
|
|
|
local RUN = {
|
|
{ 0, 0, 1174, -109, to = { -1164, -109 } }, -- runs left
|
|
{ 6, 0, hide = true },
|
|
{ 8.725, 0, -1168, -109, mirror = true, to = { 1162, -109 } }, -- back right
|
|
{ 14.75, 0, hide = true },
|
|
{ 16.375, 0, 976, -109, trip = true, to = { -1518, -109, "out" } },
|
|
{ 28.375, 0, -1164, -109, mirror = true, to = { 1162, -109 } }, -- and right again
|
|
{ 34.4, 0, hide = true },
|
|
}
|
|
|
|
-- the stumble, in beats from the start of its leg and px from where the run puts it: a few
|
|
-- strides, a misstep, and a skid forward on its belly; then it runs on further ahead
|
|
local TRIP = {
|
|
{ 0, 2, 0, 0 }, { 0.25, 1 }, { 0.5, 0 }, { 0.75, 1 }, { 1, 4 },
|
|
{ 1.25, 5, 0, 9 },
|
|
{ 1.5, 6, 0, 9, to = { 328, 9, "in" } },
|
|
length = 5.125,
|
|
}
|
|
local TRIP_RUN = { at = TRIP.length, x = 176, frames = { 2, 1, 0, 1 } }
|
|
-- its stride: four frames, the last a frame longer
|
|
local STRIDE = Timing.steps({ { 0, 0.25 }, { 1, 0.25 }, { 2, 0.25 }, { 3, 0.275 } })
|
|
|
|
local Mh3rdFever = Mh3.Fever.define({ keys = { "rathalos" }, loop = 36, delay = 0.2, fade_beats = 0.975 })
|
|
|
|
function Mh3rdFever:draw_loop(t)
|
|
local run = pose_at(RUN, t)
|
|
if not run then return end
|
|
local leg
|
|
for i = #RUN, 1, -1 do
|
|
if RUN[i][1] <= t then leg = RUN[i]; break end
|
|
end
|
|
local lt, dx, dy = t - leg[1], 0, 0
|
|
if not leg.trip then
|
|
run.frame = pose_at(STRIDE, lt % STRIDE.length).frame
|
|
elseif lt < TRIP_RUN.at then
|
|
local p = pose_at(TRIP, lt)
|
|
run.frame, dx, dy = p.frame, p.x, p.y
|
|
else
|
|
run.frame, dx = TRIP_RUN.frames[math.floor((lt - TRIP_RUN.at) * 4) % 4 + 1], TRIP_RUN.x
|
|
end
|
|
run.sx, run.sy = SCALE, SCALE
|
|
self:draw_part("rathalos", run, FEVER_AT[1] + run.x + dx, FEVER_AT[2] + run.y + dy)
|
|
end
|
|
|
|
return Mh3.background("background/collab/mh3rd", {
|
|
-- the Rathalos crest scrolls a tile every 2 s; the emblem flares and fades slowly with it
|
|
donbg = { scroll = 1983, pulse = { { 400, 5757 }, { 1450, -5757 }, { 133, 0 } } },
|
|
-- green panel over a strip of umbrellas, drums, jars and Felyne daruma
|
|
bg_fever = { tile = 376, phase = 0, strip = { tile = 1456, x = 728 } },
|
|
-- Lumen's slots, left to right: dancers 3, 1, 4, 0, 2
|
|
heights = { [0] = 264, [1] = 264, [2] = 264, [3] = 264, [4] = 264 },
|
|
centers = { 213, 427, 640, 853, 1067 },
|
|
fever = Mh3rdFever,
|
|
})
|