Jump to content

Monkey Spriter Importer Code


therevillsgames

Recommended Posts

Awhile ago I converted the LibGDX code over to Monkey http://www.monkeycoder.co.nz/ code when Spriter was first announced over on KickStarter.

I have recently rewrote it to use the current version of Spriter and it seems to work pretty well (no bones at the moment):

http://www.therevillsgames.com/monkey/SpriterA4/MonkeyGame.html

You can check the progress here:

http://www.monkeycoder.co.nz/Community/posts.php?topic=2709

Its written so that it should be pretty easy to convert to over OO languages.

Looking forward to the full release :)

Link to comment
Share on other sites

hi therevillsgames,

Awesome. I'm sure many people will really benefit from your work. I've just created this small example Spriuter file which uses bones, which might come in handy when you're ready to work on bone support.

http://www.brashmonkeygames.com/brashmonkey/spriter/BoneExample.zip

cheers,

Mike at BrashMonkey

Link to comment
Share on other sites

hi therevillsgames,

Awesome. I'm sure many people will really benefit from your work. I've just created this small example Spriuter file which uses bones, which might come in handy when you're ready to work on bone support.

http://www.brashmonkeygames.com/brashmonkey/spriter/BoneExample.zip

cheers,

Mike at BrashMonkey

Thanks Mike :)

Any chance of some pseudo code on how to implement the bones?

Oh I forgot to add this in my original post, since Monkey is a cross platform language, this code basically gives us a Spriter plugin for HTML5, XNA, Java (Android), iOS, Flash, Windows, Mac OSX and a few more targets I cant remember at the moment ;)

Link to comment
Share on other sites

for implementing bones, you basically just need to understand a few basics.

With bones, everything can possibly have a parent (but doesn't have to). The transform data (position, scale, and rotation) of each ref, be it a bone or an object, is relative only to that ref's immediate parent.

So, you must traverse the bone hierarchy from the top down, and append your transforms as you go. Luckily, the SCML data for each Timeline is structured in hierarchy descending order, so you should only need to loop through your bones once.

You can look at the source code for SpriterMC (the updatevisuals method) or grimfang's C++ implementation. There are also a few good forum posts about it:

viewtopic.php?f=3&t=5824

and

viewtopic.php?f=2&t=1400

Link to comment
Share on other sites

  • 3 weeks later...

Bones are now in :)

For the past week or so, I've been having a hard time trying to flip the bones... everything I tried messed up the angles... I was about to give up when I had a brainwave last night and thought sod flipping the bones, I'll just flip the images:

http://www.therevillsgames.com/monkey/S ... yGame.html

So its a bit of a hack, but its good enough for me to use Spriter in my games :D

Code is checked into Google Code:

https://code.google.com/p/monkey-spriter-importer/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...