Files
PyTaikoGreen/Scripts/background/bg_objects/donbg/5.lua
T
2026-10-01 16:47:45 -04:00

46 lines
1.4 KiB
Lua

local DonBGBase = require("background/bg_objects/donbg/base")
DonBG5 = setmetatable({}, { __index = DonBGBase })
DonBG5.__index = DonBG5
function DonBG5.new(index, player_num, path)
local self = setmetatable({}, DonBG5)
local base = DonBGBase.new(index, player_num, path)
for k, v in pairs(base) do
self[k] = v
end
self.bounce = tex.get_animation(4, "background")
self.bounce:start()
self.adjust = tex.get_animation(8, "background")
self.overlay_texture = tex.get_texture_info(self.name, "overlay")
self._id_overlay = tex.get_texture(self.path .. "/" .. self.name .. "/" .. "overlay") or 0
return self
end
function DonBG5:update(current_time_ms)
DonBGBase.update(self, current_time_ms)
self.bounce:update(current_time_ms)
if self.bounce.is_finished then
self.bounce:restart()
end
self.adjust:update(current_time_ms)
end
function DonBG5:draw_textures(fade, y, frame)
for i = 0, 5 do
tex.draw_texture(self._id_bg, {
frame = frame,
fade = fade,
x = (i * self.bg_texture.width) + self.move.attribute,
y = y
})
tex.draw_texture(self._id_overlay, {
frame = frame,
fade = fade,
x = (i * self.bg_texture.width) + self.move.attribute,
y = self.bounce.attribute - self.adjust.attribute + y
})
end
end
return DonBG5