diff --git a/spine-corona/main.lua b/spine-corona/main.lua index 89974f594..797219c40 100644 --- a/spine-corona/main.lua +++ b/spine-corona/main.lua @@ -102,6 +102,23 @@ function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin) --skeleton.vertexEffect = spine.JitterEffect.new(5, 5) skeleton.vertexEffect = swirl animationState:setAnimationByName(0, animation, true) + elseif jsonFile == "mix-and-match-pro.json" then + -- Create a new skin, by mixing and matching other skins + -- that fit together. Items making up the girl are individual + -- skins. Using the skin API, a new skin is created which is + -- a combination of all these individual item skins. + local skin = spine.Skin.new("mix-and-match") + skin:addSkin(skeletonData:findSkin("skin-base")) + skin:addSkin(skeletonData:findSkin("nose/short")) + skin:addSkin(skeletonData:findSkin("eyes/eyelids-girly")) + skin:addSkin(skeletonData:findSkin("eyes/violet")) + skin:addSkin(skeletonData:findSkin("hair/brown")) + skin:addSkin(skeletonData:findSkin("clothes/hoodie-orange")) + skin:addSkin(skeletonData:findSkin("legs/pants-jeans")) + skin:addSkin(skeletonData:findSkin("accessories/bag")) + skin:addSkin(skeletonData:findSkin("accessories/hat-red-yellow")) + skeleton:setSkinByReference(skin) + animationState:setAnimationByName(0, animation, true) else animationState:setAnimationByName(0, animation, true) end @@ -110,6 +127,7 @@ function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin) return { skeleton = skeleton, state = animationState } end +table.insert(skeletons, loadSkeleton("mix-and-match.atlas", "mix-and-match-pro.json", 240, 300, 0.3, "dance")) table.insert(skeletons, loadSkeleton("spineboy.atlas", "spineboy-pro.json", 240, 300, 0.4, "walk")) table.insert(skeletons, loadSkeleton("stretchyman.atlas", "stretchyman-stretchy-ik-pro.json", 40, 300, 0.5, "sneak")) table.insert(skeletons, loadSkeleton("coin.atlas", "coin-pro.json", 240, 160, 0.4, "animation")) diff --git a/spine-love/main.lua b/spine-love/main.lua index 05e97a914..07e45478d 100644 --- a/spine-love/main.lua +++ b/spine-love/main.lua @@ -65,6 +65,24 @@ function loadSkeleton (jsonFile, atlasFile, animation, skin, scale, x, y) skeleton.vertexEffect = swirl -- skeleton.vertexEffect = spine.JitterEffect.new(10, 10) end + + if jsonFile == "mix-and-match-pro" then + -- Create a new skin, by mixing and matching other skins + -- that fit together. Items making up the girl are individual + -- skins. Using the skin API, a new skin is created which is + -- a combination of all these individual item skins. + local skin = spine.Skin.new("mix-and-match") + skin:addSkin(skeletonData:findSkin("skin-base")) + skin:addSkin(skeletonData:findSkin("nose/short")) + skin:addSkin(skeletonData:findSkin("eyes/eyelids-girly")) + skin:addSkin(skeletonData:findSkin("eyes/violet")) + skin:addSkin(skeletonData:findSkin("hair/brown")) + skin:addSkin(skeletonData:findSkin("clothes/hoodie-orange")) + skin:addSkin(skeletonData:findSkin("legs/pants-jeans")) + skin:addSkin(skeletonData:findSkin("accessories/bag")) + skin:addSkin(skeletonData:findSkin("accessories/hat-red-yellow")) + skeleton:setSkinByReference(skin) + end -- set some event callbacks state.onStart = function (entry) @@ -95,6 +113,7 @@ end function love.load(arg) if arg[#arg] == "-debug" then require("mobdebug").start() end skeletonRenderer = spine.SkeletonRenderer.new(true) + table.insert(skeletons, loadSkeleton("mix-and-match-pro", "mix-and-match", "dance", nil, 0.5, 400, 500)) table.insert(skeletons, loadSkeleton("spineboy-pro", "spineboy", "walk", nil, 0.5, 400, 500)) table.insert(skeletons, loadSkeleton("stretchyman-pro", "stretchyman", "sneak", nil, 0.3, 200, 500)) table.insert(skeletons, loadSkeleton("coin-pro", "coin", "animation", nil, 0.5, 400, 300)) diff --git a/spine-lua/Skeleton.lua b/spine-lua/Skeleton.lua index 0bb4a25ad..7d2062d61 100644 --- a/spine-lua/Skeleton.lua +++ b/spine-lua/Skeleton.lua @@ -27,6 +27,7 @@ -- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- +local utils = require "spine-lua.utils" local Bone = require "spine-lua.Bone" local Slot = require "spine-lua.Slot" local IkConstraint = require "spine-lua.IkConstraint"