[lua] Ported AnimationState changes

This commit is contained in:
badlogic 2016-11-24 13:00:46 +01:00
parent a7fe570148
commit aca4060fad
4 changed files with 8637 additions and 8629 deletions

View File

@ -61,7 +61,15 @@ function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin)
print(entry.trackIndex.." event: "..entry.animation.name..", "..event.data.name..", "..event.intValue..", "..event.floatValue..", '"..(event.stringValue or "").."'")
end
animationState:setAnimationByName(0, animation, true)
if atlasFile == "spineboy.atlas" then
animationStateData:setMix("walk", "jump", 0.4)
animationStateData:setMix("jump", "run", 0.4);
animationState:setAnimationByName(0, "walk", true)
local jumpEntry = animationState:addAnimationByName(0, "jump", false, 3)
animationState:addAnimationByName(0, "run", true, 0)
else
animationState:setAnimationByName(0, animation, true)
end
-- return the skeleton an animation state
return { skeleton = skeleton, state = animationState }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -123,7 +123,7 @@ function loadSkeleton (name, initialAnimation, premultipliedAlpha, skin) {
animationStateData.setMix("jump", "run", 0.4);
animationState.setAnimation(0, "walk", true);
var jumpEntry = animationState.addAnimation(0, "jump", false, 3);
animationState.addAnimation(0, "run", true);
animationState.addAnimation(0, "run", true, 0);
} else {
animationState.setAnimation(0, initialAnimation, true);
}