Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spritesheet class is broken, in the web Ctx #22

Open
wkta opened this issue Apr 12, 2024 · 1 comment
Open

Spritesheet class is broken, in the web Ctx #22

wkta opened this issue Apr 12, 2024 · 1 comment

Comments

@wkta
Copy link
Member

wkta commented Apr 12, 2024

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
Copy link
Member Author

wkta commented Apr 22, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant