pyved-engine icon indicating copy to clipboard operation
pyved-engine copied to clipboard

Spritesheet class is broken, in the web Ctx

Open wkta opened this issue 1 year ago • 1 comments

How to reproduce the bug? you can use the following file for testing!

tileset

In your source-code (gamedef.py), use a spritesheet .png without any json information tied to it ,then

Spritesheet = pyv.gfx.Spritesheet 
tileset = Spritesheet(img, 2)  # use upscaling x2
tileset.set_infos((32, 32))
EXIT_TILE_RANK = 24
adhoc_exit_tile = shared.TILESET.image_by_rank(EXIT_TILE_RANK)
# your custom code goes there
...
# then, we blit but we pass a full Rect (4 parameters)
scrref.blit(
    adhoc_exit_tile,
    (potion['position'][0] * shared.CELL_SIDE, potion['position'][1] * shared.CELL_SIDE,
    32, 32)
)

this will crash in web ctx

wkta avatar Apr 12 '24 11:04 wkta

the problem is related only to the case you use : a spritesheet without the JSON data + pre-defined loading mechanism (when loading an asset that has the format: thing.json+thing.png the class gfx.JsonBasedSprSheet is automatically used and that method works fine in the web ctx)

wkta avatar Apr 22 '24 17:04 wkta