Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Can't get Spine examples to work with current build (2014.2189)
Started by _memo Mar 20 2014 01:15 AM

11 replies to this topic
spine
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

_memo

[GLOBAL: userInfoPane.html]
_memo
  • Contributor

  • 289 posts
  • Corona SDK

Hi guys,

 

I was looking at the Spine tool and it seems quite impressive, but I'm wondering if it's compatible with recent Corona builds - does anyone know for sure? Has anyone tried running the examples from Spine with 2014.2189?

 

Here's what I did

- Downloaded examples from

https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine-corona

- Copied spine-lua to spine-corona/spine-lua

- Included the Graphics 2.0 tweaks from this pull request: https://github.com/EsotericSoftware/spine-runtimes/pull/192

- Tried to run the Spineboy example

 

The example is supposed to show some draw order shuffling, jump, and then walk indefinitely. However, the walking animation does not work. In the Goblin example, no animation works at all, the goblin just stands there blinking its eyes.

 

I also tried without the Graphics 2.0 pull request and enabling Graphics 1.0 compatibility mode. No luck.

 

Anyone? :-)



[TOPIC: post.html]
#2

coronasdk771

[GLOBAL: userInfoPane.html]
coronasdk771
  • Enthusiast

  • 44 posts
  • Corona SDK

Can't check right now (@work), but animation works for me 2014.2189 when applied pull request you mentioned.



[TOPIC: post.html]
#3

Julio DeVega

[GLOBAL: userInfoPane.html]
Julio DeVega
  • Enthusiast

  • 57 posts
  • Corona SDK

No worries about the spine examples they're not that much working, they work but with bugs !

The General Idea of the runtime work, so check everywhere in topics on spine website and here and make your own runtime.

I think Spine developer are going to edit that later



[TOPIC: post.html]
#4

_memo

[GLOBAL: userInfoPane.html]
_memo
  • Contributor

  • 289 posts
  • Corona SDK

Thanks for the help, everyone!

 

I ended up buying Spine, and it does indeed work with 2014.2189 and Graphics 2.0. Just got my first animations into the game. :-)



[TOPIC: post.html]
#5

_memo

[GLOBAL: userInfoPane.html]
_memo
  • Contributor

  • 289 posts
  • Corona SDK

I've reached the conclusion that in the current Spine runtime, Animations work fine, but AnimationStates do not. This is why none of the Spine examples are working.

 

I tried to debug the AnimationState a bit to see what's going wrong, but couldn't figure it out. Plan B is to just use Animations and roll my own AnimationState, I guess :-)

 

Has anyone got AnimationStates working with the current Corona build?



[TOPIC: post.html]
#6

Reaver

[GLOBAL: userInfoPane.html]
Reaver
  • Enthusiast

  • 87 posts
  • Corona SDK

The current corona build should not matter for the AnimationState since most of the actual runtime that corona uses is the plain lua runtime. What is the issue with AnimationState?

 

I currently have AnimationState working, but it is not the most recent spine-runtime or corona build.



[TOPIC: post.html]
#7

_memo

[GLOBAL: userInfoPane.html]
_memo
  • Contributor

  • 289 posts
  • Corona SDK

Thanks for the feedback! My issue is basically that the bones do not get moved. Other parts of the animation happen (draw order changes and image slot replacements / "eye blinking"), but otherwise the skeletons stand still.

 

Excerpt of my code:

 

local skeletonJson = spine.SkeletonJson.new()
skeletonJson.scale = 0.35
self.skeletonData = skeletonJson:readSkeletonDataFile("img/player/player.json")
self.skeleton = spine.Skeleton.new(self.skeletonData)

function self.skeleton:createImage (attachment)
  return display.newImage("img/player/" .. attachment.name .. ".png")
end

self.skeleton:setToSetupPose()

local animationStateData = spine.AnimationStateData.new(self.skeletonData)
self.animationState = spine.AnimationState.new(animationStateData)
self.animationState:setAnimationByName(0, "stand1", true)

Runtime:addEventListener("enterFrame", function(event) self:animate(event) end) 

(...)

function player:animate(event)
  local delta = 0.01
  self.animationState:update(delta)
  self.animationState:apply(self.skeleton)
  self.skeleton:updateWorldTransform()
end

Am I doing something incorrectly? If I use the animation directly, e.g. skeletonData.findAnimation("stand1"):apply(skeleton), the animation works.

 

Thanks again for helping me out with this. :-)

 

PS: I know the delta isn't supposed to be a fixed value but use the system time, this is just me playing with the speed of the animations.



[TOPIC: post.html]
#8

Reaver

[GLOBAL: userInfoPane.html]
Reaver
  • Enthusiast

  • 87 posts
  • Corona SDK

Unfortunately I can't see anything there that looks like a problem. I'm at work right now so I can't really look into it :/



[TOPIC: post.html]
#9

_memo

[GLOBAL: userInfoPane.html]
_memo
  • Contributor

  • 289 posts
  • Corona SDK

Actually, merely your statement that you got AnimationStates working with an older version of the Spine runtime pointed me in the right direction. I went to the Git repo and checked out an old version of AnimationState.lua (from January), and AnimationState now seems to be working correctly!

 

Thanks again for the help.



[TOPIC: post.html]
#10

Reaver

[GLOBAL: userInfoPane.html]
Reaver
  • Enthusiast

  • 87 posts
  • Corona SDK

Cool. Glad it worked out :)

 

Good luck going forward.



[TOPIC: post.html]
#11

Julio DeVega

[GLOBAL: userInfoPane.html]
Julio DeVega
  • Enthusiast

  • 57 posts
  • Corona SDK

Actually, merely your statement that you got AnimationStates working with an older version of the Spine runtime pointed me in the right direction. I went to the Git repo and checked out an old version of AnimationState.lua (from January), and AnimationState now seems to be working correctly!

 

Thanks again for the help.

Thanks guys ! I was looking for an issue with the same problem, I did not even think about it

It helps me a lot, I thought it was my mistake.

Now almost everything work fine ;)



[TOPIC: post.html]
#12

richard9

[GLOBAL: userInfoPane.html]
richard9
  • Corona Geek

  • 1,118 posts
  • Enterprise

Just FYI, but it seems the Runtimes have been updated. I gave it a run and I believe it works now without any sort of hacking involved.

 

Note that both the spine-corona and spine-lua folders are updated.




[topic_controls]
[/topic_controls]