Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

custom export javascript for animation sequences?
Started by greg886 Jun 04 2013 04:09 PM

6 replies to this topic
[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

greg886

[GLOBAL: userInfoPane.html]
greg886
  • Contributor

  • 909 posts
  • Corona SDK

Has anyone already developed a custom javascript that would automatically include  animation sequence data in the exported files.  eg walk, run?     This could be based on detecting identical name parts and build a list containing the frames.

 

That is automatically putting in lines such as this (that I add manually in a separate LUA file myself currently)

 

local sequenceData = {
      { name="prestall", frames={ 3,6 }, time=200, loopCount=0 },
      { name="canopy", frames={ 5 }, time=1000, loopCount=0 },
       { name="freefall", frames={ 4 }, time=1000, loopCount=0 },
       { name="running", frames={ 1,2,3,4,5,6 }, time=1000, loopCount=0 },

 

 

 



[TOPIC: post.html]
#2

Elliott

[GLOBAL: userInfoPane.html]
Elliott
  • Enthusiast

  • 52 posts
  • Corona SDK

I tried to do this but found it easier to use Level Director (www.retrofitproductions.com/level-director).

You can import texturepacker & physicseditor files then create and view animation sequences.

It does all the hard work for you and exports a lua file with all the data in it (I use the template export option). 



[TOPIC: post.html]
#3

greg886

[GLOBAL: userInfoPane.html]
greg886
  • Contributor

  • 909 posts
  • Corona SDK

Thanks Elliott - oh, seems to be a Windows product (no Mac version).  There's no Mac equivalent you're aware of?  

 

Wondering how good it is in terms of running it under VMWare on my Mac.  Does it help with the case that say you have an existing spite sheet all working in Corona, then you want to add one more separate sprite to the sheet.   Can you easily add it via Level Director and export new files (image and lua) such that you don't have to change/adjust any of your game code?   I guess this should work if in Level Director you specifiy the name of the animation sequence and don't have to reference this from your Corona Code from frame numbers?



[TOPIC: post.html]
#4

Elliott

[GLOBAL: userInfoPane.html]
Elliott
  • Enthusiast

  • 52 posts
  • Corona SDK

Yes sorry should have mentioned Windows only but that suited me fine.

It should work fine in VMWare though.

 

Yes Level Director does everything, it will export all your assets (as many spritesheets or single images as you like), animations and level data into a separate lua file so your game code does not change each time, you then simple access the objects and play the animations by name.

It comes with some example projects that show you how to use it.

 

The developers are also super quick to repsond and add new feature requests so I'm a big fan of it.



[TOPIC: post.html]
#5

greg886

[GLOBAL: userInfoPane.html]
greg886
  • Contributor

  • 909 posts
  • Corona SDK

tks (just bought it actually to try out)

 

by the way - Did you happen to have looked at SpriteHelper here?  Just wondering if it's a potential solution for me too, or whether just to run with Level Director?   (by solution I mean ability to update/add sprites without changing code in the game really)



[TOPIC: post.html]
#6

Elliott

[GLOBAL: userInfoPane.html]
Elliott
  • Enthusiast

  • 52 posts
  • Corona SDK

Spritehelper is for mac only I think so I didn't try it (Windows user I'm afraid).

 

I think i know what you mean now, so you have a spritesheet with say 5 sprites in it but then you decide to add 2 more to it?

I'm pretty sure Level Director will detect the spritesheet has changed and add them so they will automatically be included as an asset next time you export your data.

It has some lua helper functions too, so if you don't want to add the sprite to the level straight away you can add it dynamically.

 

This was taken from one of the examples where a spritesheet containing an animated dog was added to level director and then this code in the main.lua file simply adds an instance to the foreground display group layer 'fg' @ x,y with a scale of 1,1. 

It then starts the 'walk' animation.

 

local dog = levelDirector.CreateObjectFromAsset(myLevel.layers["fg"], myAssets, 
"dog", 250, 300, 1, 1)
dog:prepare("walk")
 


[TOPIC: post.html]
#7

greg886

[GLOBAL: userInfoPane.html]
greg886
  • Contributor

  • 909 posts
  • Corona SDK

thats it Elliott,

 

Oh - there was a reason I was using Texture Packer too which I forgot.  With TP I can customize the different resolutions, so I am currently specifying a 1x, 2x and 4x resolution I require.  When I publish with TP it automatically:

 - creates the PNG images for each resolution (with the file extension you want)

 - creates the LUA file (for Corona) for each of the resolutions too 

 

So I'm not sure if LevelDirector covers this requirement?




[topic_controls]
[/topic_controls]