Hi,
I'm currently evaluating Spine with CoronaSDK. I've cobbled together a simple corona project based on the project included with the corona/lua runtime download. Basically I have the goblin walking animation and a couple buttons, one to swap the weapon between dagger and spear, and the other to swap between the male and female goblins. Here's the code for my button handler:
local function handleButtonEvent( event )
local phase = event.phase
if "ended" == phase then
print( "You pressed and released button "..event.target.id )
if event.target.id == "button_1" then
---
change the weapon
if weaponName == "spear" then weaponName = "dagger"
elseif weaponName == "dagger" then weaponName = "spear"
end
skeleton:setAttachment ("left hand item", weaponName)
elseif event.target.id == "button_2" then
---
change the skin
if skinName == "goblin" then skinName = "goblingirl"
elseif skinName == "goblingirl" then skinName = "goblin"
end
skeleton:setSkin(skinName)
end
end
end
When I run the app and the goblin walk cycles and the swapping weapons button works fine. But pressing the swap skin button I get a runtime crash that fails at line 91 in Skeleton.lua with the error message "Attempt to call a table value".
I don't think I'm doing anything fancy, although without runtime docs. I can't be sure. I saw the java code in the spine workshop examples and there is similar code to switch skins with a keypress, so I assume I am supposed to be able to swap skins on the fly. It seems like there is some issue with applying a new skin on an already skinned skeleton.
Any ideas? Sorry if it's obvious, I'm a noob to Spine.