HitFX, Early/Late display with ms #35
|
@ -66,11 +66,11 @@ end
|
||||||
|
|
||||||
function render_crit_base(deltaTime)
|
function render_crit_base(deltaTime)
|
||||||
CritLine.renderBase(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation, gameplay.critLine.cursors);
|
CritLine.renderBase(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation, gameplay.critLine.cursors);
|
||||||
HitFX.render(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation, gameplay.critLine.cursors);
|
|
||||||
Console.render(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation);
|
Console.render(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation);
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_crit_overlay(deltaTime)
|
function render_crit_overlay(deltaTime)
|
||||||
|
HitFX.render(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation, gameplay.critLine.cursors);
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_intro(deltaTime)
|
function render_intro(deltaTime)
|
||||||
|
|
|
@ -13,26 +13,51 @@ local Animations = {
|
||||||
Near = Animation.new('gameplay/hit_animation_frames/near_taps', {
|
Near = Animation.new('gameplay/hit_animation_frames/near_taps', {
|
||||||
centered = true,
|
centered = true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
HoldCrit = Animation.new('gameplay/hit_animation_frames/hold_critical', {
|
||||||
|
centered = true,
|
||||||
|
loop = true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
HoldDome = Animation.new('gameplay/hit_animation_frames/hold_dome', {
|
||||||
|
centered = true,
|
||||||
|
loop = true,
|
||||||
|
loopPoint = 10
|
||||||
|
}),
|
||||||
|
|
||||||
|
HoldEnd = Animation.new('gameplay/hit_animation_frames/hold_end', {
|
||||||
|
centered = true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
HoldInner = Animation.new('gameplay/hit_animation_frames/hold_inner', {
|
||||||
|
centered = true,
|
||||||
|
loop = true,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
local animationStates = {
|
---@class HoldStateTable
|
||||||
---@type AnimationState[]
|
---@field Crit AnimationState
|
||||||
Hold = { },
|
---@field Dome AnimationState
|
||||||
---@type AnimationState[]
|
---@field End AnimationState
|
||||||
Tap = { }
|
---@field Inner AnimationState
|
||||||
};
|
|
||||||
|
---@type HoldStateTable[]
|
||||||
|
local holdStateTables = {}
|
||||||
|
|
||||||
|
for i = 1, 6 do
|
||||||
|
holdStateTables[i] = {
|
||||||
|
Crit = Animations.HoldCrit:createState(),
|
||||||
|
Dome = Animations.HoldDome:createState(),
|
||||||
|
End = Animations.HoldEnd:createState(),
|
||||||
|
Inner = Animations.HoldInner:createState()
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type AnimationState[]
|
||||||
|
local tapStates = {}
|
||||||
|
|
||||||
local HitFX = { };
|
local HitFX = { };
|
||||||
|
|
||||||
local LanePositions = {
|
|
||||||
1.5 / 6,
|
|
||||||
2.5 / 6,
|
|
||||||
3.5 / 6,
|
|
||||||
4.5 / 6,
|
|
||||||
1 / 3,
|
|
||||||
2 / 3
|
|
||||||
};
|
|
||||||
|
|
||||||
local function setupLaneTransform(lanePosition, critCenterX, critCenterY)
|
local function setupLaneTransform(lanePosition, critCenterX, critCenterY)
|
||||||
local critLine = gameplay.critLine;
|
local critLine = gameplay.critLine;
|
||||||
local x = critCenterX + (critLine.line.x2 - critLine.line.x1) * lanePosition;
|
local x = critCenterX + (critLine.line.x2 - critLine.line.x1) * lanePosition;
|
||||||
|
@ -55,40 +80,63 @@ function HitFX.render(deltaTime, critCenterX, critCenterY, critRotation, cursors
|
||||||
lanePosition = -track.GetCurrentLaneXPos(6) - laneWidth / 2
|
lanePosition = -track.GetCurrentLaneXPos(6) - laneWidth / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
local holdState = animationStates.Hold[i];
|
-- Holds
|
||||||
local tapState = animationStates.Tap[i];
|
local isHeld = gameplay.noteHeld[i]
|
||||||
|
local holdStates = holdStateTables[i]
|
||||||
|
local isAnimationPlaying = holdStates.Dome.running
|
||||||
|
|
||||||
local isHeld = gameplay.noteHeld[i];
|
if isHeld and not isAnimationPlaying then
|
||||||
if (isHeld) then
|
holdStates.Crit:restart()
|
||||||
if (holdState) then
|
holdStates.Dome:restart()
|
||||||
if (not holdState.running) then
|
holdStates.Inner:restart()
|
||||||
holdState:restart();
|
|
||||||
end
|
|
||||||
|
|
||||||
setupLaneTransform(lanePosition, critCenterX, critCenterY);
|
|
||||||
holdState:render(deltaTime);
|
|
||||||
gfx.ResetTransform();
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if (holdState and holdState.running) then
|
|
||||||
holdState:restart();
|
|
||||||
end
|
|
||||||
|
|
||||||
if (tapState and tapState.running) then
|
|
||||||
setupLaneTransform(lanePosition, critCenterX, critCenterY);
|
|
||||||
tapState:render(deltaTime, {
|
|
||||||
centered = true,
|
|
||||||
width = hitSize,
|
|
||||||
height = hitSize,
|
|
||||||
});
|
|
||||||
gfx.ResetTransform();
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not isHeld and isAnimationPlaying then
|
||||||
|
holdStates.Crit:stop()
|
||||||
|
holdStates.Dome:stop()
|
||||||
|
holdStates.Inner:stop()
|
||||||
|
|
||||||
|
holdStates.End:restart()
|
||||||
|
end
|
||||||
|
|
||||||
|
setupLaneTransform(lanePosition, critCenterX, critCenterY)
|
||||||
|
holdStates.Inner:render(deltaTime, {
|
||||||
|
centered = true,
|
||||||
|
width = hitSize,
|
||||||
|
height = hitSize
|
||||||
|
})
|
||||||
|
holdStates.Dome:render(deltaTime, {
|
||||||
|
centered = true,
|
||||||
|
width = hitSize,
|
||||||
|
height = hitSize
|
||||||
|
})
|
||||||
|
holdStates.Crit:render(deltaTime, {
|
||||||
|
centered = true,
|
||||||
|
width = hitSize,
|
||||||
|
height = hitSize
|
||||||
|
})
|
||||||
|
holdStates.End:render(deltaTime, {
|
||||||
|
centered = true,
|
||||||
|
width = hitSize,
|
||||||
|
height = hitSize
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Taps
|
||||||
|
local tapState = tapStates[i]
|
||||||
|
|
||||||
|
if tapState then
|
||||||
|
tapState:render(deltaTime, {
|
||||||
|
centered = true,
|
||||||
|
width = hitSize,
|
||||||
|
height = hitSize,
|
||||||
|
});
|
||||||
|
end
|
||||||
|
gfx.ResetTransform()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function HitFX.TriggerAnimation(name, lane)
|
function HitFX.TriggerAnimation(name, lane)
|
||||||
animationStates.Tap[lane] = Animations[name]:start();
|
tapStates[lane] = Animations[name]:start();
|
||||||
end
|
end
|
||||||
|
|
||||||
return HitFX;
|
return HitFX;
|
||||||
|
|
Loading…
Reference in New Issue