forked from Yonokid/PyTaikoGreen
- The fan strips repeat every 80 px but were tiled every 600 and 520 px, so the arcs broke and overlapped where copies met; both are tiled (and scroll a whole tile per loop) every 560 px now - A third fan row fills the gap above the lane where the cloud's base showed - Fans at footer y 110, Fuji and clouds lower, matching the reference screen - The floor sits 34 px lower so the drums clear the lane; its bottom rows are cut at the bottom band Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
116 lines
4.4 KiB
Lua
116 lines
4.4 KiB
Lua
local DonBG = require("background/bg_objects/donbg")
|
|
local DonBGBase = require("background/bg_objects/donbg/base")
|
|
|
|
local COLLAB_PATH = "background/collab/tutorial"
|
|
|
|
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.width, 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(COLLAB_PATH .. "/" .. self.name .. "/" .. "overlay") or 0
|
|
self._id_footer = tex.get_texture(COLLAB_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
|
|
|
|
-- One Fuji (background frame 1), one cloud (overlay) and one set of dots (background frame 2) per
|
|
-- pattern tile, all scrolling with the pattern: the Fuji's foot behind the fans, the dots around
|
|
-- the clouds (they bob with them). The cloud's place in the tile is overlay's x in texture.json.
|
|
local FUJI_X, FUJI_Y = 39, 91
|
|
local CLOUD_Y = 32
|
|
local DOTS_X, DOTS_Y = 32, CLOUD_Y + 13
|
|
-- The fans repeat every 80 px: their strips are tiled (and scroll a whole tile per loop) every
|
|
-- 560 px, a multiple of that, so the copies line up.
|
|
local FAN_TILE = 560
|
|
local FLOOR_DY = 34
|
|
|
|
function TutorialDonBG:draw_textures(fade, y, frame)
|
|
y = y + 40
|
|
local tile = self.bg_texture.width
|
|
local bob = self.overlay_move.attribute
|
|
for i = 0, 4 do
|
|
tex.draw_texture(self._id_bg, {
|
|
frame = 0,
|
|
fade = fade,
|
|
x = (i * tile) + self.move.attribute,
|
|
y = y
|
|
})
|
|
end
|
|
for i = 0, 3 do
|
|
local x = (i * tile) + self.move.attribute
|
|
tex.draw_texture(self._id_bg, { frame = 1, fade = fade, x = x + FUJI_X, y = y + FUJI_Y })
|
|
tex.draw_texture(self._id_overlay, { frame = frame, fade = fade, x = x, y = y + CLOUD_Y + bob })
|
|
tex.draw_texture(self._id_bg, { frame = 2, fade = fade, x = x + DOTS_X, y = y + DOTS_Y + bob })
|
|
end
|
|
local fan_x = self.move.attribute * (FAN_TILE / tile)
|
|
for i = 0, 4 do
|
|
tex.draw_texture(self._id_footer, { frame = 0, fade = fade, x = (i * FAN_TILE) + fan_x, y = y + bob })
|
|
tex.draw_texture(self._id_footer, { frame = 1, fade = fade, x = (i * FAN_TILE) + fan_x, y = (y + 30) + bob })
|
|
-- a third row so the fans reach down to the lane
|
|
tex.draw_texture(self._id_footer, { frame = 1, fade = fade, x = (i * FAN_TILE) + fan_x, y = (y + 60) + bob })
|
|
end
|
|
end
|
|
|
|
TutorialBackground = {}
|
|
TutorialBackground.__index = TutorialBackground
|
|
|
|
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
|
|
self.floor_texture = tex.get_texture_info("bg_0", "background")
|
|
|
|
return self
|
|
end
|
|
|
|
function TutorialBackground:update(current_ms, bpm)
|
|
self.donbg:update(current_ms, bpm)
|
|
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()
|
|
-- the floor sits FLOOR_DY lower than texture.json says, so the drums clear the lane; the rows that
|
|
-- would then run into the bottom band are cut off
|
|
tex.draw_texture(self._id_bg_0, {
|
|
y = FLOOR_DY, y2 = -FLOOR_DY,
|
|
src = { x = 0, y = 0, width = self.floor_texture.width, height = self.floor_texture.height - FLOOR_DY },
|
|
})
|
|
end
|
|
|
|
function TutorialBackground:draw_fore() end
|
|
|
|
function TutorialBackground:destroy()
|
|
self.donbg:destroy()
|
|
tex.unload_folder(COLLAB_PATH, "bg_normal/bg_0")
|
|
end
|
|
|
|
return TutorialBackground
|