How to reuse full loaded frames for many sprites?

SGDK only sub forum

Moderator: Stef

Post Reply
masteries
Very interested
Posts: 53
Joined: Thu Jul 30, 2020 3:33 pm

How to reuse full loaded frames for many sprites?

Post by masteries » Mon Nov 01, 2021 1:52 pm

Greetings mates,

I am trying to reuse full loaded frames for many different sprites, with no success.

I loaded full frames for a single sprite, released the sprite; and the frame data still remains in VRAM;
after this I wan trying to create sprite with Auto tile upload disable... but with no clue regarding how to point the exact tile number for each frame...

Obviously, this bizarre trial doesn´t work well.


Next image illustrates the need:

Image

Each enemy shoot needs to share the same full loaded frames, as well it is neccesary to disable dinamically tile uploading for these "bullet" sprites, due to all frames (4 tiles) are always loaded in VRAM

Usually, I manage the VRAM tile index used by each sprite type via SPR_setVRAMTileIndex after a call to SPR_addSprite .

As well, enemy soldier leg sprites will need to share their full loaded frames.
Some sprites are currently a composition of 2 sprites, in order to save memory and create an easier animation code.


Thanks in advance,

masteries
Very interested
Posts: 53
Joined: Thu Jul 30, 2020 3:33 pm

Re: How to reuse full loaded frames for many sprites?

Post by masteries » Tue Nov 02, 2021 8:55 am

Learned a way to do it, from the Sonic sample.

SOLVED

danibus
Very interested
Posts: 135
Joined: Sat Feb 03, 2018 12:41 pm

Re: How to reuse full loaded frames for many sprites?

Post by danibus » Thu Jan 20, 2022 10:56 pm

masteries wrote:
Tue Nov 02, 2021 8:55 am
Learned a way to do it, from the Sonic sample.

SOLVED
Can you post how u solved it? It will help a lot other folks!

masteries
Very interested
Posts: 53
Joined: Thu Jul 30, 2020 3:33 pm

Re: How to reuse full loaded frames for many sprites?

Post by masteries » Wed Feb 02, 2022 1:17 pm

danibus wrote:
Thu Jan 20, 2022 10:56 pm
masteries wrote:
Tue Nov 02, 2021 8:55 am
Learned a way to do it, from the Sonic sample.

SOLVED
Can you post how u solved it? It will help a lot other folks!
I encoutered problems with player and enemy bullets,
the workaround is based in create these sprites, do not destroy them,
and relocate them out of screen when not used

Post Reply