melonjs / melonJS

a fresh, modern & lightweight HTML5 game engine
https://melonjs.org
MIT License
5.77k stars 641 forks source link

Animation broken on WebGL if TextureAtlas has multiple textures #1207

Closed CodeAndWeb closed 4 weeks ago

CodeAndWeb commented 8 months ago

When an animated sprite is created with createAnimationFromName() on a TextureAtlas which has multiple textures ("multi-pack"), all animation frames must be placed on the first texture. Otherwise the animation is broken:

broken-animation

To Reproduce

  1. git clone -b multipack-broken https://github.com/CodeAndWeb/melonjs-sprite-sheet-example.git
  2. npm run dev
obiot commented 8 months ago

oh ! interesting ! thank you for reporting it !

CodeAndWeb commented 8 months ago

Same problem when creating a single sprite with atlas.createSpriteFromName("spritename"). Is multi-pack supported at all? or am I doing something wrong?

obiot commented 8 months ago

well it is supposed to be supported, but I guess either with limitations, or we had some regression in the last few versions, I'll definitely look into it

obiot commented 8 months ago

Hi, so I cloned your git, executed it and ...... it's just working here .... Oct-18-2023 09-44-31

is there something I'm missing to reproduce the bug ?

CodeAndWeb commented 8 months ago

Have you checked out the "multipack-broken" branch?

obiot commented 8 months ago

of course it did not.... sorry, I did not realize there was a specific branch for it. Saw it now and indeed it's not working properly

customautosys commented 6 months ago

Dear Olivier,

Facing same problem on WebGL:

bildo

Canvas is working fine:

bildo

Have already updated my package to the latest melonJS release

obiot commented 6 months ago

wow thank you ! I was really scratching my head with this one, looking at the logic implementation of the multi-texture TextureAtlas support, and could not find what was wrong. Now thank to you, I know that the issue is with the WebGL renderer, and now I know where to look !

obiot commented 6 months ago

I managed to pin point the issue, it's actually a regression following that change : https://github.com/melonjs/melonJS/commit/16c5d3c8e369a333e1dde7be3482cd32d50d472d

obiot commented 4 weeks ago

fixed in version 17.3.0