56 lines
1.8 KiB
Lua
56 lines
1.8 KiB
Lua
local DonBGBase = require("background/bg_objects/donbg/base")
|
|
DonBG3 = setmetatable({}, { __index = DonBGBase })
|
|
DonBG3.__index = DonBG3
|
|
|
|
function DonBG3.new(index, player_num, path)
|
|
local self = setmetatable({}, DonBG3)
|
|
local base = DonBGBase.new(index, player_num, path)
|
|
for k, v in pairs(base) do
|
|
self[k] = v
|
|
end
|
|
self.bounce_up = tex.get_animation(4)
|
|
self.bounce_down = tex.get_animation(5)
|
|
self.bounce_up:start()
|
|
self.bounce_down:start()
|
|
self.overlay_move = tex.get_animation(6)
|
|
self.overlay_move_2 = tex.get_animation(7)
|
|
self.overlay_texture = tex.get_texture_info(self.name, "overlay")
|
|
self._id_overlay = tex.get_id(self.name, "overlay") or 0
|
|
return self
|
|
end
|
|
|
|
function DonBG3:update(current_time_ms)
|
|
DonBGBase.update(self, current_time_ms)
|
|
self.bounce_up:update(current_time_ms)
|
|
self.bounce_down:update(current_time_ms)
|
|
if self.bounce_down.is_finished then
|
|
self.bounce_up:restart()
|
|
self.bounce_down:restart()
|
|
end
|
|
self.overlay_move:update(current_time_ms)
|
|
self.overlay_move_2:update(current_time_ms)
|
|
end
|
|
|
|
function DonBG3:draw_textures(fade, y, frame)
|
|
for i = 0, 10 do
|
|
tex.draw_texture(self._id_bg, {
|
|
frame = frame,
|
|
fade = fade,
|
|
x = (i * self.bg_texture.width) + self.move.attribute,
|
|
y = y
|
|
})
|
|
end
|
|
local y_pos = self.bounce_up.attribute - self.bounce_down.attribute + self.overlay_move.attribute +
|
|
self.overlay_move_2.attribute
|
|
for i = 0, 6 do
|
|
tex.draw_texture(self._id_overlay, {
|
|
frame = frame,
|
|
fade = fade,
|
|
x = (i * self.overlay_texture.width) + (self.move.attribute * 2),
|
|
y = y_pos + y
|
|
})
|
|
end
|
|
end
|
|
|
|
return DonBG3
|