local BaseChibi = require("Skins/PyTaikoGreen/Scripts/bg_objects/chibi/base") Chibi13 = setmetatable({}, { __index = BaseChibi }) Chibi13.__index = Chibi13 function Chibi13.new(index, bpm, is_2p, path) path = path or "background" bpm = bpm or 120 local self = setmetatable({}, Chibi13) local base = BaseChibi.new(index, bpm, is_2p, path) for k, v in pairs(base) do self[k] = v end local duration = (60000 / self.bpm) self.scale = anim.fade(duration, { initial_opacity = 1.0, final_opacity = 0.75, delay = duration, reverse_delay = duration, loop = true }) self.scale:start() self.frame = 0 return self end function Chibi13:update(current_time_ms, bpm) BaseChibi.update(self, current_time_ms, bpm) self.scale:update(current_time_ms) if bpm and bpm ~= self.bpm then local duration = (60000 / self.bpm) self.scale = anim.fade(duration, { initial_opacity = 1.0, final_opacity = 0.75, delay = duration, reverse_delay = duration, loop = true }) self.scale:start() end if self.scale.attribute == 0.75 then self.frame = 1 else self.frame = 0 end end function Chibi13:draw() local game_2p_offset = tex.get_skin_config("game_2p_offset") or {y = 0} local y_offset = self.is_2p and game_2p_offset.y or 0 tex.draw_texture(self.name, "tail", { frame = self.frame, x = self.hori_move.attribute, y = -self.vert_move.attribute + y_offset }) if self.scale.attribute == 0.75 then tex.draw_texture(self.name, tostring(self.texture_index), { frame = self.frame, x = self.hori_move.attribute, y = -self.vert_move.attribute + y_offset }) else tex.draw_texture(self.name, tostring(self.texture_index), { frame = self.frame, scale = self.scale.attribute, center = true, x = self.hori_move.attribute, y = -self.vert_move.attribute + y_offset }) end end return Chibi13