Skip to content

Converts Spriter SCML files to lua file for use with Moai SDK

Notifications You must be signed in to change notification settings

miletbaker/spriter2moai

Repository files navigation

Spriter to Moai

Spriter SCML to Moai generator. This library allows you to import animations created using BrashMonkey Spriter (http://www.brashmonkey.com/spriter.htm) and use them in Moai (http://gemoai.com)

Requirements:

  • This library assumes you are using a version older then Spriter a2 and currently does not support animations that make use of the new IK bones introduced in Spriter a4. This should be added shortly, the current work around is to create your animations and then create a copy of the project with all the bones deleted before exporting.
  • This library also requires the use of TexturePacker to generate the textures (with all sprite parts using consistent names with those used in Spriter and no folder prefixes in the TexturePacker generated lua files)

scml2moai.py

This python script is required to convert the CSML file into a lua file for use in Moai.

Usage:

> ./scml2moai.py -h

Usage: scml2moai.py file.scml [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -f FILE, --file=FILE  specify output FILE (default outputs to same name as
                        scml file)
  -4, --x4              Dimensions are based on @4x size also output @2x.lua
                        and standard .lua files
  -2, --x2              Dimensions are based on @2x size also output standard
                        .lua files
  • -f - Use this option if you want to specify an output .lua filename (Default will use the same name as the scml file with a .lua extension)
  • -4 - Use this if you have generated your artwork for large resolution tablets and desktops and then used Texture Packer to create sizes for smart phones, tablets/retina iPhones (@2x extension) and HD tables screens (@4x extension). This creates three lua files. @4x.lua for use with full size artwork, @2x for use with 50% artwork and .lua for use with 25% size artwork.
  • -2 - Use this if you have generated your artwork for retina iPhones / SD tablets (@2x) and then used Texture Packer to create sizes for SD smart phones. *This creates two lua files. @2x for use with full size artwork and .lua for use with 50% size artwork.

lib/tpsloader.lua

Require this lua file for the logic to load in Texture Packer lua files, as provided within the Moai samples folder.

lib/spriter.lua

Require this lua file to load the scml2moai lua file generated by the script above (See main.lua for an example of usage). This file is based on the Flash Tween example provided in the Moai sample folder.

Assets and example files

The following files and folders contain the example scml file and assets as provided on the BrashMonkey on their site here http://www.brashmonkey.com/spriter.htm

  • example.scml (as well as example.lua generated by scml2moai.py above)
  • mon_arms
  • mon_head
  • mon_legs
  • mon_shadow
  • mon_torso

The following files were generated by Texture Packer

  • monster.lua (Lua texture map)
  • monster.png (texture file)
  • monster.tps (Texture Packer project file)

Licence

These files unless specified in the source header are distributed under the MPL-2.0 licence (http://opensource.org/licenses/MPL-2.0)

About

Converts Spriter SCML files to lua file for use with Moai SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published