local DonBG = require("Skins/PyTaikoGreen/Scripts/bg_objects/donbg") local ChibiController = require("Skins/PyTaikoGreen/Scripts/bg_objects/chibi") local PracticeBackground = require("Skins/PyTaikoGreen/Scripts/bg_collabs/practice") Background = {} Background.__index = Background function Background.new(player_num, bpm, scene_preset) local self = setmetatable({}, Background) self.player_num = player_num self.bpm = bpm self.scene_preset = scene_preset tex.load_animations("background") if scene_preset == "PRACTICE" then self.collab = PracticeBackground.new(player_num, bpm) else tex.load_folder("background", "bg_normal/bg_0") self.donbg = DonBG.create(player_num, "background") self.chibi = ChibiController.new(bpm, "background") end return self end function Background:update(current_ms, bpm) self.bpm = bpm if self.collab then self.collab:update(current_ms, bpm) else self.donbg:update(current_ms) self.chibi:update(current_ms, bpm) end end function Background:handle_good(player_num) if self.collab then self.collab:handle_good(player_num) else self.chibi:add_chibi(player_num, false) end end function Background:handle_ok(player_num) if self.collab then self.collab:handle_ok(player_num) else self.chibi:add_chibi(player_num, false) end end function Background:handle_bad(player_num) if self.collab then self.collab:handle_bad(player_num) else self.chibi:add_chibi(player_num, true) end end function Background:handle_drumroll(player_num) if self.collab then self.collab:handle_drumroll(player_num) end end function Background:handle_balloon(player_num) if self.collab then self.collab:handle_balloon(player_num) end end function Background:handle_gauge(player_num, progress, is_clear, is_rainbow) if self.collab then self.collab:handle_gauge(player_num, progress, is_clear, is_rainbow) else self.donbg:set_clear(is_clear) end end function Background:draw_back() if self.collab then self.collab:draw_back() else self.donbg:draw() self.chibi:draw() tex.draw_texture("bg_0", "background") end end function Background:draw_fore() if self.collab then self.collab:draw_fore() end end function Background:destroy() if self.collab then self.collab:destroy() end end