Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.


#1 2022-10-30 18:03:43

New member
Registered: 2022-10-30
Posts: 2

using png2asset with differant sized metasprites


I am making  a double dragon game, using GBDK's png2asset to convert the characters sprites into tile data

The sprites are like so :

Some meta sprites like walking animation are 16x32 tiles, some like the jump-kick and punch meta sprite are 32x32

How can I use png2asset to handle multiple sized metasprite.

I think I could group meta sprite by size into multiple .png like linda.png and linda_extended.png and switch sprite data accordingly when the player jump or punch ?

Or maybe, arranging every sprites in a 32x32 grid ?

Does this seems to be a good solution ? I would like to keep using png2asset even for multiple sized sprite, how you guys would handle this problem ?




#2 2022-10-30 20:56:41

Registered: 2019-03-04
Posts: 112

Re: using png2asset with differant sized metasprites

Yes, try using a 32x32 grid. png2asset will only assign sprites for the parts of the 32x32 area which have non-background pixels.

Note: right now png2asset only checks for duplicate regions (aka reducing sprite VRAM pattern data used) on a 8x8 or 8x16 grid (maybe better in the future).



#3 2022-11-05 15:14:41

New member
Registered: 2022-10-30
Posts: 2

Re: using png2asset with differant sized metasprites

Edit: I figured it out using the metasprite example, … asprites.c


   if (hide)
            hide_metasprite(sprite_metasprites[idx], SPR_NUM_START);
            hiwater = move_metasprite(sprite_metasprites[idx], TILE_NUM_START, SPR_NUM_START, (PosX >> 4), (PosY >> 4));

        // Hide rest of the hardware sprites, because amount of sprites differ between animation frames.
        hide_sprites_range(hiwater, MAX_HARDWARE_SPRITES);

Thanks for your advice, I change the sprite sheet to have 32x32 sprites

I build the asset using -w32 -h32

This is working fine, except for a sprite "artefact' on screen, after a jump there is a part of the jump kick sprite that stay on screen … sp=sharing

Any idea what could cause this ? this occurs when display a 16x32 sprite then a 32x32 sprite

main.c source: … src/main.c

Last edited by drev (2022-11-07 00:40:15)



#4 2022-11-29 04:38:59

Registered: 2020-02-13
Posts: 291

Re: using png2asset with differant sized metasprites

look into the gbdk-2020/examples/cross-platform/metasprites/ example: elephant animation states consist of different amount of hardware sprites. you need to calculate the "hiwater" value of all rendered metasprites and then use hide_sprites_range() function to hide the rest.



Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson