forked from Yonokid/YataiDONNijiiro
- Japanese narration in scene order, Chinese (zh) captions, skip and clear text - New tutorial background: pattern, mountains, clouds and four wave rows on their own scroll/bob timelines, still floor - Tutorial music and sound effects (side hit, balloon, clear, burn) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88 lines
3.1 KiB
Lua
88 lines
3.1 KiB
Lua
-- YataiDONNijiiro tutorial background: the layers in Graphics/background/tutorial_ac on their
|
|
-- own timelines (bg_data/tutorial_ac): pattern, mountains, clouds and four wave rows scroll left
|
|
-- (loop 320 frames), the clouds and waves bob (120 frames), the floor stands still. The screen
|
|
-- keeps a black band above (y < 60) and below (y >= 1020) the art.
|
|
|
|
local TRACKS = require("background/bg_data/tutorial_ac")
|
|
local L = TRACKS.layers
|
|
|
|
local FOLDER = "tutorial_ac"
|
|
local PATH = "background/" .. FOLDER
|
|
local FRAME_MS = 1000.0 / 60.0
|
|
local BAND_TOP = 60
|
|
local CLOUD_X0, CLOUD_PITCH, CLOUD_COUNT = 600, 744, 5 -- the clouds' places inside their strip
|
|
local CLOUD_Y0 = 30 -- the cloud's own offset in its exported frame
|
|
|
|
TutorialBackground = {}
|
|
TutorialBackground.__index = TutorialBackground
|
|
|
|
function TutorialBackground.new(player_num, bpm)
|
|
local self = setmetatable({}, TutorialBackground)
|
|
tex.load_folder("background", FOLDER)
|
|
self.id = {}
|
|
for _, name in ipairs({ "pat", "mtn", "cloud", "w13", "w16", "w21", "w24", "floor" }) do
|
|
self.id[name] = tex.get_texture(PATH .. "/" .. name) or 0
|
|
end
|
|
self.t0 = nil
|
|
self.f = 0
|
|
return self
|
|
end
|
|
|
|
function TutorialBackground:update(current_ms, bpm)
|
|
if not self.t0 then self.t0 = current_ms end
|
|
self.f = math.max(0, math.floor((current_ms - self.t0) / FRAME_MS))
|
|
end
|
|
|
|
local function at(track, list, f, n)
|
|
return track[list][(f % n) + 1]
|
|
end
|
|
|
|
-- a strip whose x / y follow its track; rows above the top band are cut off
|
|
function TutorialBackground:strip(name, track_name, f)
|
|
local tr = TRACKS[track_name]
|
|
local x = at(tr, "x", f, tr.n)
|
|
local y = name == "pat" and 0 or (name == "mtn" and 0 or at(tr, "y", f, 120))
|
|
local top = y + L[name].ytop
|
|
local cut = math.max(0, BAND_TOP - top)
|
|
tex.draw_texture(self.id[name], {
|
|
x = x, y = top + cut, y2 = -cut,
|
|
src = { x = 0, y = cut, width = L[name].w, height = L[name].h - cut },
|
|
})
|
|
end
|
|
|
|
function TutorialBackground:handle_good(player_num) end
|
|
|
|
function TutorialBackground:handle_ok(player_num) end
|
|
|
|
function TutorialBackground:handle_bad(player_num) end
|
|
|
|
function TutorialBackground:handle_drumroll(player_num) end
|
|
|
|
function TutorialBackground:handle_balloon(player_num) end
|
|
|
|
function TutorialBackground:handle_gauge(player_num, progress, is_clear, is_rainbow) end
|
|
|
|
function TutorialBackground:draw_back()
|
|
local f = self.f
|
|
tex.draw_texture(self.id.floor, { y = L.floor.y })
|
|
self:strip("pat", "pat", f)
|
|
self:strip("mtn", "mtn", f)
|
|
local cx = at(TRACKS.cloud, "x", f, TRACKS.cloud.n)
|
|
local cy = at(TRACKS.c9, "y", f, 120) - CLOUD_Y0
|
|
for k = 0, CLOUD_COUNT - 1 do
|
|
tex.draw_texture(self.id.cloud, { x = cx + CLOUD_X0 + CLOUD_PITCH * k + L.cloud.dx, y = cy + L.cloud.dy })
|
|
end
|
|
self:strip("w13", "w13", f)
|
|
self:strip("w16", "w16", f)
|
|
self:strip("w21", "w21", f)
|
|
self:strip("w24", "w24", f)
|
|
end
|
|
|
|
function TutorialBackground:draw_fore() end
|
|
|
|
function TutorialBackground:destroy()
|
|
tex.unload_folder("background", FOLDER)
|
|
end
|
|
|
|
return TutorialBackground
|