Hi,
I am running into an issue but not sure how to fix it. The issue that I am having is when I switch from one animation I would like the animation to complete first before going to the next animation.
example:
I have a player that is running and when I tap on the fire button the player shots beams from its hands but I have to hold down the fire button in order for the fire animation to complete.
I have used the mix function but it does not work, here is some of my code:
function ChangeAnimation()
if(LoadPlayer.animationType == "idle") then
AnimationIdle:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
elseif(LoadPlayer.animationType == "run") then
AnimationRun:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
elseif(LoadPlayer.animationType == "Jump") then
AnimationJump:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
elseif(LoadPlayer.animationType == "idle-Shooting_Up") then
AnimationRunShootingUp:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
elseif(LoadPlayer.animationType == "Run-Shooting_Forward") then
AnimationRunShootingforward:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
elseif(LoadPlayer.animationType == "Crouch") then
AnimationCrouch:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
elseif(LoadPlayer.animationType == "Run-Shooting_135") then
AnimationRunShooting_135:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
elseif(LoadPlayer.animationType == "Run-Shooting_45") then
AnimationRunShooting_45:mix(skeleton, LoadPlayer.animationTime, true, 0.75)
end
skeleton:updateWorldTransform()
end
Runtime:addEventListener("enterFrame", function (event)
Compute time in seconds since last frame.
local currentTime = event.time / 1000
local delta = currentTime - LoadPlayer.lastTime
LoadPlayer.lastTime = currentTime
Accumulate time and pose skeleton using animation.
LoadPlayer.animationTime = LoadPlayer.animationTime + delta
ChangeAnimation()
end)
Any help would greatly be appreciated.
JCP