Jump to content

Need help with spritesheets


shikshake
 Share

Recommended Posts

You should never really need to think about JSON/XML files if you use a texture atlas generator, which will take away your frustrations. It will just generate the JSON/XML for you and you can just call the sprite by name, without worrying about x, y, width etc.

I'd recommend TexturePacker or if you want a free solution this looks like it will do the job: Texture Atlas Creator

Link to comment
Share on other sites

19 hours ago, shikshake said:

Is there any way to manually add frames from an atlas to an animation by specifying x,y,length,width? I don't want to bother with json/xml files, they're frustrating to work with,

Maybe you can try with an asset manager like the one provided in Phaser Editor (dealing with atlas is lot easier).

You can create the atlas and load it in the game very easy. Even in the JS editor you can auto-complete the frame names and pre-visualize it.

and very soon it will get a scene builder so you will create the sprites animations in an assisted and visual way.

 

(Image: smart coding assist shows the atlas frames and a preview of them)

assets-key-assist.png

 

(Image: you can create your atlas textures with the built-in atlas generator)

texture-packer.png

 

 

Link to comment
Share on other sites

By the way, you also have the option to avoid using XML/JSON and load spritesheets, via:

game.load.spritesheet(...)

Just that you have to pack the texture yourself, but it is easy.

Then you create the animations by passing the frame indexes:

var sprite = game.add.sprite(0, 0, "dino");

sprites.animations.add("my-anim", [0, 1, 2]);

 

In the mentioned editor you can do it very easy too :)

 

(Image: Asset pack editor and preview of spritesheet)

Spritesheet.png

 

 

Link to comment
Share on other sites

There are many tools to create a spritesheet (aka sprite atlas or sprite texture), see this thread: What Spritesheet toolkit does everyone use? Personally, I use the Leshy SpriteSheet Tool.

But more importantly; what are you trying now to create animations, can you give your code example? And what exactly do you find frusting about working with json/xml files?
 

Link to comment
Share on other sites

3 hours ago, BdR said:

There are many tools to create a spritesheet (aka sprite atlas or sprite texture), see this thread: What Spritesheet toolkit does everyone use? Personally, I use the Leshy SpriteSheet Tool.

But more importantly; what are you trying now to create animations, can you give your code example? And what exactly do you find frusting about working with json/xml files?
 

I'm using Kenney's assets (http://kenney.nl/assets) and his xml files have the wrong coordinates for the spritesheet it's assigned to. I wanted to use the  spritesheet anyway, but since that isn't possible I'll just stick them together manually.

Link to comment
Share on other sites

7 hours ago, shikshake said:

I'm using Kenney's assets (http://kenney.nl/assets) and his xml files have the wrong coordinates for the spritesheet it's assigned to. I wanted to use the  spritesheet anyway, but since that isn't possible I'll just stick them together manually.

:mellow:??

If the assets you bought(?) are unusable, you should contact them and ask if their files are incorrectly formatted or if you are using them incorrect or something.

Alternatively, can't you just cut out the individual sprites you want to use (or all) and save them as separate .png files. And then drop them into Leshy SpriteSheet Tool or Shoebox? Then you have your correct sprite sheet.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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