* replace frame based laser anim with code based anim in songwheel

This commit is contained in:
FajsiEx 2021-08-16 16:29:21 +02:00
parent 44da7da60c
commit c75925ff92
2 changed files with 26 additions and 9 deletions

View File

@ -13,6 +13,8 @@ local illustratedBgImage = gfx.CreateSkinImage("song_select/data_panel/illust_bg
local songPlateBg = gfx.CreateSkinImage("song_select/plate/bg.png", 1)
local songPlateBottomBarOverlayImage = gfx.CreateSkinImage("song_select/plate/bottom_bar_overlay.png", 1)
local laserAnimBaseImage = gfx.CreateSkinImage("song_select/laser_anim.png", 1)
local top50OverlayImage = gfx.CreateSkinImage("song_select/top50.png", 1)
local top50JacketOverlayImage = gfx.CreateSkinImage("song_select/top50_jacket.png", 1)
@ -90,9 +92,6 @@ local difficultyLabelUnderImages = {
gfx.CreateSkinImage("songtransition/difficulty_labels/vvd.png", 0),
}
-- ANIMS
local laserAnimation = gfx.LoadSkinAnimation('song_select/laser_anim', 1/60, 0, false);
game.LoadSkinSample('song_wheel/cursor_change.wav');
game.LoadSkinSample('song_wheel/diff_change.wav');
@ -125,6 +124,9 @@ local transitionAfterscrollTextSongArtist = 0;
local transitionAfterscrollDifficultiesAlpha = 0;
local transitionAfterscrollJacketBgAlpha = 0;
local transitionLaserScale = 0;
local transitionLaserY = 0;
local transitionLeaveReverse = false;
local transitionLeaveScale = 0;
local transitionLeaveOffsetY = 0;
@ -215,6 +217,16 @@ function getGradeImageForScore(score)
return gradeImage;
end
function drawLaserAnim()
gfx.BeginPath()
gfx.Scissor(0, transitionLaserY, desw, 100);
gfx.ImageRect(0, 0, desw, desh, laserAnimBaseImage, 1, 0)
gfx.ResetScissor();
end
function drawBackground(deltaTime)
gfx.BeginPath()
gfx.ImageRect(0, 0, desw, desh, backgroundImage, 1, 0)
@ -239,12 +251,7 @@ function drawBackground(deltaTime)
gfx.ImageRect(0, 0, desw, desh, dataPanelImage, 1, 0)
local laserAnimTickRes = gfx.TickAnimation(laserAnimation, deltaTime);
if laserAnimTickRes == 1 then
gfx.BeginPath()
gfx.ImageRect(0, 0, desw, desh, laserAnimation, 1, 0);
gfx.GlobalAlpha(1);
end
drawLaserAnim()
if song and diff then
gfx.BeginPath()
@ -571,6 +578,16 @@ function tickTransitions(deltaTime)
transitionAfterscrollJacketBgAlpha = 1;
end
-- Laser anim
if transitionLaserScale < 1 then
transitionLaserScale = transitionLaserScale + deltaTime / 3 -- transition should last for that time in seconds
else
transitionLaserScale = 0
end
transitionLaserY = desh - math.min(transitionLaserScale * 2 * desh, desh);
-- Leave transition
if (transitionLeaveReverse) then
if transitionLeaveScale > 0 then

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB