Linzeestomp

Spritesheet Multipack / Rotation bugged?

Recommended Posts

Been testing Phaser 3 with TexturePacker recently (says it supports Phaser 3 which supports multi-packing and rotation). Some issues I've seen so far:

When rendering spritesheets and JSON files generated by TexturePacker for Phaser 3 I learned the following things:

1.) Rotation MUST be set to true when using Multi-packs---Maybe I'm still too noob to understand why this is a thing but is there currently no way for us to use a JSON file with a spritesheet without setting rotation to true when using multi-packs?

1.a) When multi-packing and rotation are enabled all sprites that were rotated to generate the sheet are ignored in the animation that fires--literally there's jumps in the animations. The fix I found for this is to simply pack all the sprites into a massive spritesheet and just ignore atlas' with multi-packing. Help would be appreciated if I'm doing something wrong here.

2) The "repeat" attribute from the AnimationConfig does not function as indicated in the documentation--in fact it doesn't seem to do really anything? I've been trying to get a death animation to play and simply stop, once the animation has finished firing one time. Can't seem to do this...with ANY animations. It just loops endlessly regardless of it's value.

See: https://photonstorm.github.io/phaser3-docs/global.html#AnimationConfig

3) Also, the "paused" attribute does nothing when set to "true". Nor does the "pauseAll" method?

4) Is there a hard limit to how many frames can be used for an animation or a maximum spritesheet size that engine will take? I noticed the closer I got to a 4000x4000 spritesheet it seemed like the engine was just like "WHOA--THAT'S TOO MUCH!" and I started getting errors regarding frame generation by the engine.

P.S. The new documentation manager is super awesome appreciated! Finding what I'm searching for doesn't feel like such a lost cause anymore. Thanks!

Share this post


Link to post
Share on other sites

@photonstorm - Sorry - but this does not seem to be right. I've a demo running with rotated sprites in the Phaser3 exporter - and it works without any problems... (also see your announcement here: https://phaser.io/phaser3/devlog/48 - you must have added the code at some point in time :))

But I also have issues with multipack - especially with the code we've added for the new json files that contain all the Texture references. What was the intended way to load a multipack json file? Whatever I try - it always tries to use the json file name and replaces .json with .png.

I assume that this is what is happening in this case: Instead of loading scene-1.png and scene-2.png as specified in the .json file -  it loads the (old) scene.png file which does not match the data anymore.

 

 

Share this post


Link to post
Share on other sites

Please don't enable rotation. There is literally no code supporting it anywhere in the canvas renderer, so unless you have forced WebGL only in your game, it won't work. There's also no support for it when extracting sprite sheets or bitmap fonts that are embedded into an atlas as rotated frames (un-rotated is fine)

Loading a multi-atlas file is trivial, just point it at the JSON file, it extracts the image names from the JSON itself:

    this.load.multiatlas('megaset', 'tp3-multi-atlas.json');

If it's not a multi-atlas, use the old 'load.atlas' call instead.

Share this post


Link to post
Share on other sites

@photonstorm Thanks! Your are right - it only works in WebGL...

We'll disable the "Rotate Sprites" feature from the exporter with the next TexturePacker update. Please let me know if you extend the canvas renderer to support rotated sprites.

I've also updated our How to create sprite sheets with Phaser 3 tutorial... this one might also help @Linzeestomp

 

Share this post


Link to post
Share on other sites

@photonstorm

Thanks for the clarification Richard, but on this tutorial on the Phaser website, it looks as if texture atlas frame rotation works with both Canvas and WebGL with Phaser 2.

https://phaser.io/tutorials/advanced-rendering-tutorial/part7

I personally use Phaser 3, and was looking around the internet for how to enable sprite rotation with Phaser 3 because when I used Texture Packer with the default (Phaser 3) settings for my sprites, it rotated many of them.

When I previewed the sprite animations in the browser, the sprites weren't being unrotated, despite Phaser 3 DevLog #48 announcing support for the functionality. (i guess it was only for WebGL then)

https://phaser.io/phaser3/devlog/48

 

So would the best solution be to not rotate sprites within our atlases (turn off the setting in TexturePacker),

or use sprite rotation but force Phaser to render in WebGL (I personally tried this by changing Phaser.AUTO to Phaser.WEBGL, and it didn't work)

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.