Files
YataiDONNijiiro/Scripts/background/bg_collabs/tutorial.lua
T
2026-10-01 16:48:11 -04:00

117 lines
3.9 KiB
Lua

-- YataiDON-HSS override of PyTaikoGreen/background/bg_collabs/tutorial.lua: tile steps/scroll period use x2[1]; +40/-80/+30 px literals *sc
local DonBG = require("background/bg_objects/donbg")
local DonBGBase = require("background/bg_objects/donbg/base")
local TutorialDonBG = setmetatable({}, { __index = DonBGBase })
TutorialDonBG.__index = TutorialDonBG
function TutorialDonBG.new(index, player_num, path)
local self = setmetatable({}, TutorialDonBG)
local base = DonBGBase.new(index, player_num, path)
for k, v in pairs(base) do
self[k] = v
end
self.move = anim.move(6000, { total_distance = -self.bg_texture.x2[1], loop = true })
self.move:start()
self.overlay_move = tex.get_animation(2, "background")
self.overlay_texture = tex.get_texture_info(self.name, "overlay")
self.footer_texture = tex.get_texture_info(self.name, "footer")
self._id_overlay = tex.get_texture(self.path .. "/" .. self.name .. "/overlay") or 0
self._id_footer = tex.get_texture(self.path .. "/" .. self.name .. "/footer") or 0
return self
end
function TutorialDonBG:update(current_time_ms)
DonBGBase.update(self, current_time_ms)
self.overlay_move:update(current_time_ms)
end
function TutorialDonBG:draw_textures(fade, y, frame)
local sc = tex.get_screen_scale()
y = y + 40 * sc
for i = 0, 4 do
tex.draw_texture(self._id_bg, {
frame = 0,
fade = fade,
x = (i * self.bg_texture.x2[1]) + self.move.attribute,
y = y
})
tex.draw_texture(self._id_bg, {
frame = 1,
fade = fade,
x = (i * self.bg_texture.x2[1]) + self.move.attribute,
y = y
})
end
for i = 0, 5 do
tex.draw_texture(self._id_overlay, {
frame = frame,
fade = fade,
x = (i * self.overlay_texture.x2[1]) +
self.move.attribute * (self.overlay_texture.width / self.bg_texture.width),
y = y + self.overlay_move.attribute
})
end
for i = 0, 4 do
tex.draw_texture(self._id_footer, {
frame = 0,
fade = fade,
x = (i * self.footer_texture.x2[1]) +
self.move.attribute * (self.footer_texture.width / self.bg_texture.width),
y = y + self.overlay_move.attribute
})
tex.draw_texture(self._id_footer, {
frame = 1,
fade = fade,
x = (i * (self.footer_texture.x2[1] - 80 * sc)) +
self.move.attribute * (self.footer_texture.width / self.bg_texture.width),
y = (y + 30 * sc) + self.overlay_move.attribute
})
end
end
TutorialBackground = {}
TutorialBackground.__index = TutorialBackground
local COLLAB_PATH = "background/collab/tutorial"
function TutorialBackground.new(player_num, bpm)
local self = setmetatable({}, TutorialBackground)
tex.load_folder(COLLAB_PATH, "bg_normal/bg_0")
self.donbg = TutorialDonBG.new(1, player_num, COLLAB_PATH)
self._id_bg_0 = tex.get_texture(COLLAB_PATH .. "/bg_0/background") or 0
return self
end
function TutorialBackground:update(current_ms, bpm)
self.donbg:update(current_ms)
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()
self.donbg:draw()
tex.draw_texture(self._id_bg_0)
end
function TutorialBackground:draw_fore() end
function TutorialBackground:destroy()
self.donbg:destroy()
tex.unload_folder(COLLAB_PATH, "bg_normal/bg_0")
end
return TutorialBackground