Author Topic: Question about making spritesheets from flash animations  (Read 1418 times)

Esti

  • Active Member
  • ***
  • Posts: 104
  • Karma: +0/-0
    • View Profile
http://www.leebrimelow.com/?p=3104

Today I saw this video about the new features of flash (I think it is CS6) and I was wondering some things.

First of all what is that file with coordinates and code that gets exported with the PNG sprite sheet. I suppose is the code that has the dimensions and coordinates of every image, but If I want to use this kind of sprite with flixel, shouldn't I have every frame with the same dimension? Using this in this way wouldn't be worse in terms of memory? How can I trim the images to save space but get them working on flixel?


Check it out on Mochi!

auriplane

  • Snails!!
  • Contributor
  • ****
  • Posts: 497
  • Karma: +1/-0
  • Snails!!
    • View Profile
I don't think you have to worry about wasted space in a sprite sheet.  That's the sort of thing you only worry about if and when it becomes a problem, because I don't think it's likely to, for most people.

Try it, and check your memory usage.  Does it spike insanely?  No?  Then it's okay :-D

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
CS6 exports a JSON file with the sprite sheet, which you'd use in html5 based games to know where to cut each frame from. There are other tools that do this, Texture Packer being probably the best, but the free ShoeBox and Zoe might also be worth looking at.

As for using any of the above for flixel I just don't see the point! Keep your movieclip and just use it in your game. Convert it to a sprite sheet on the fly via code if you really need to.

Yeah there is loads of wasted space in sprite sheets usually. It's because CS6 exports it frame by frame, flickerbook style and doesn't optimise it into a proper texture atlas (I've no idea why not). This is much less of an issue in flash games where png's can be compressed nicely, but it's a real problem for html5 games.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

Esti

  • Active Member
  • ***
  • Posts: 104
  • Karma: +0/-0
    • View Profile
As for using any of the above for flixel I just don't see the point! Keep your movieclip and just use it in your game. Convert it to a sprite sheet on the fly via code if you really need to.

So I don't loose all the helpful classes of the FlxSprite if I use a movieclip as a sprite? what about the performance, animations and that stuff?

Check it out on Mochi!

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Flash is designed for running movieclips, it's what it is good at! and it does it very very well. If you really need to shove a clip into an flxsprite I see two choices - render the frames to a sprite sheet at run time (feels a bit heavy to me) or just use an invisible flxsprite of the same size to act as the "actor" in the game and shove the movieclips on the top, following it's x/y coords.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius