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.

Ads

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

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

using png2asset with differant sized metasprites

Hi!

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

The sprites are like so :

https://www.spriters-resource.com/resources/sheets/60/63097.png?updated=1460963169

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 ?

thanks

Offline

 

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

bbbbbr
Member
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).

Offline

 

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

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

Re: using png2asset with differant sized metasprites

Edit: I figured it out using the metasprite example, https://github.com/gbdk-2020/gbdk-2020/ … asprites.c

Code:

   if (hide)
            hide_metasprite(sprite_metasprites[idx], SPR_NUM_START);
        else
            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

https://raw.githubusercontent.com/odrevet/game-boy-game/sprite32x32/linda/assets/linda.png

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

https://drive.google.com/file/d/1rO6HC_ … sp=sharing

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

main.c source:  https://github.com/odrevet/game-boy-gam … src/main.c

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

Offline

 

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

toxa
Member
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.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson