pyved-engine
pyved-engine copied to clipboard
Spritesheet class is broken, in the web Ctx
How to reproduce the bug? you can use the following file for testing!
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
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)