forked from Yonokid/PyTaikoGreen
99 lines
3.3 KiB
Lua
99 lines
3.3 KiB
Lua
EntryPlayer = {}
|
|
EntryPlayer.__index = EntryPlayer
|
|
|
|
function EntryPlayer.new(side)
|
|
local self = setmetatable({}, EntryPlayer)
|
|
self.side = side
|
|
|
|
local drum_offset_cfg = tex.get_skin_config("entry_drum_offset")
|
|
local chara_offset_r = tex.get_skin_config("entry_chara_offset_r")
|
|
self.chara_y_base = chara_offset_r.y
|
|
|
|
if side == 0 then
|
|
self.drum = tex.load_texture("entry/side_select/red_drum")
|
|
self.drum_offset = drum_offset_cfg.x
|
|
local chara_l = tex.get_skin_config("entry_chara_offset_l")
|
|
self.chara_x_offset = chara_l.x
|
|
else
|
|
self.drum = tex.load_texture("entry/side_select/blue_drum")
|
|
self.drum_offset = drum_offset_cfg.y
|
|
self.chara_x_offset = chara_offset_r.x
|
|
end
|
|
|
|
self.cloud = tex.load_texture("entry/side_select/cloud")
|
|
|
|
self.drum_move_1 = tex.get_animation(2, "entry")
|
|
self.drum_move_2 = tex.get_animation(3, "entry")
|
|
self.drum_move_3 = tex.get_animation(4, "entry")
|
|
self.cloud_resize = tex.get_animation(5, "entry")
|
|
self.cloud_resize_loop = tex.get_animation(6, "entry")
|
|
self.cloud_texture_change = tex.get_animation(7, "entry")
|
|
self.cloud_fade = tex.get_animation(8, "entry")
|
|
self.nameplate_fadein = tex.get_animation(12, "entry")
|
|
|
|
return self
|
|
end
|
|
|
|
function EntryPlayer:start_animations()
|
|
self.drum_move_1:start()
|
|
self.drum_move_2:start()
|
|
self.drum_move_3:start()
|
|
self.cloud_resize:start()
|
|
self.cloud_resize_loop:start()
|
|
self.cloud_texture_change:start()
|
|
self.cloud_fade:start()
|
|
self.nameplate_fadein:start()
|
|
end
|
|
|
|
function EntryPlayer:update(current_ms)
|
|
self.drum_move_1:update(current_ms)
|
|
self.drum_move_2:update(current_ms)
|
|
self.drum_move_3:update(current_ms)
|
|
self.cloud_resize:update(current_ms)
|
|
self.cloud_texture_change:update(current_ms)
|
|
self.cloud_fade:update(current_ms)
|
|
self.cloud_resize_loop:update(current_ms)
|
|
self.nameplate_fadein:update(current_ms)
|
|
end
|
|
|
|
function EntryPlayer:draw_drum_back()
|
|
local move_x = self.drum_move_3.attribute
|
|
local move_y = self.drum_move_1.attribute + self.drum_move_2.attribute
|
|
|
|
if self.side ~= 0 then move_x = -move_x end
|
|
|
|
tex.draw_texture(self.drum, { x = move_x, y = move_y })
|
|
|
|
local chara_x = move_x + self.drum_offset + self.chara_x_offset
|
|
local chara_y = self.chara_y_base + move_y
|
|
return { chara_x, chara_y }
|
|
end
|
|
|
|
function EntryPlayer:draw_drum_front()
|
|
local move_x = self.drum_move_3.attribute
|
|
local move_y = self.drum_move_1.attribute + self.drum_move_2.attribute
|
|
if self.side ~= 0 then move_x = -move_x end
|
|
|
|
local scale = self.cloud_resize.attribute
|
|
if self.cloud_resize.is_finished then
|
|
scale = math.max(1.0, self.cloud_resize_loop.attribute)
|
|
end
|
|
|
|
tex.draw_texture(self.cloud, {
|
|
frame = math.floor(self.cloud_texture_change.attribute),
|
|
scale = scale,
|
|
center = true,
|
|
x = move_x + self.drum_offset,
|
|
y = move_y,
|
|
fade = self.cloud_fade.attribute,
|
|
})
|
|
end
|
|
|
|
function EntryPlayer:is_cloud_finished()
|
|
return self.cloud_texture_change.is_finished
|
|
end
|
|
|
|
function EntryPlayer:get_nameplate_fade()
|
|
return self.nameplate_fadein.attribute
|
|
end
|