Jump to content

Sprite Sheets that are not Uniform


DylanD
 Share

Recommended Posts

Hello again everyone!

I was wondering if there was a way to get all the sprites in a sprite sheet automatically like they do here http://doc.babylonjs.com/babylon101/sprites but with sprites that are not uniform size (cellSize is not uniform).  I know I could manually do it but I have many sprites and that could be very time consuming, and very messy.

So I'm hoping there is a way to have sprite manager automatically make the cells.  

Any ideas?

Link to comment
Share on other sites

Quote from the doc:

Quote

Starting with Babylon.js v2.1, you can define sprite's width and height:

player.width = 0.3; player.height = 0.4;

 

Link to comment
Share on other sites

11 minutes ago, aWeirdo said:

Oh i thought you ment a spritesheet where different sprites have different sizes? 
like there might be a man 100x100 and then a tree 100x200

yes this is what I meant.

 

40 minutes ago, aWeirdo said:

not without a json mapping or something of the sprites, something needs to tell where each sprite start & end :) 
uniform sprite sheets can be done like that because you just add the sprite size each time you need to find the next one.

How could I do a json mapping ?

 

 

 

 

20 minutes ago, Deltakosh said:

You can also directly define manager.cellWidth and manager.cellHeight :)

 

22 minutes ago, Deltakosh said:

Quote from the doc:

 

I have tried this but its all manual...

 

Thanks for the response though.

Link to comment
Share on other sites

often, spritesheet editing/creation tools have json exports.. (they map the sprites as you add them to the sheet)

but i don't think you can automaticly create them from an already finished spritesheet,
it simply would have no way of telling where one starts and the next ends.

Link to comment
Share on other sites

Just now, aWeirdo said:

often, spritesheet editing/creation tools have json exports.. (they map the sprites as you add them to the sheet)

but i don't think you can automaticly create them from an already finished spritesheet,
it simply would have no way of telling where one starts and the next ends.

oh.  A .png.meta file wouldn't have this information would it?

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.

Loading...
 Share

  • Recently Browsing   0 members

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