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 2018-01-14 02:13:21

jobalisk
Member
From: I don't even know anymore...
Registered: 2017-05-28
Posts: 55
Website

Loading sprites into a specific area of the VRAM or something similar

So here's the rub. I have a game with multiple banks. The first bank contains the sprites for my main player. Another bank contains some sprites for other objects I want to load in. I can place one set of sprites or the other but then when I go to place the second set of sprites later it overwrites the sprites in the VRAM with the new ones. I have an area of the VRAM I am not using, so short of simply loading up a sprite set with blank sprites to pad the VRAM out to that point, wasting a lot of valuable storage in the process, how do I put the sprites I also want to display into that area?

Offline

 

#2 2018-01-14 02:41:34

ssjason123
Member
Registered: 2017-03-21
Posts: 45

Re: Loading sprites into a specific area of the VRAM or something similar

How are you copying your tile data to VRAM? Are you using ASM or GBDK? Are you using a DMA to load your tiles?

Assuming you are using GBDK through just set_sprite_data calls. You would use the first parameter (first_tile) to change the tile position you start writing to in VRAM:
set_sprite_data(UBYTE first_tile,
                UBYTE nb_tiles,
                unsigned char *data);

For example if your first call loads 10 tiles, use 10 as as the first_tile argument on the second call to append the second set of sprites. Just make sure you account for that offset on anything that uses the sprite.

Offline

 

#3 2018-01-15 00:33:32

jobalisk
Member
From: I don't even know anymore...
Registered: 2017-05-28
Posts: 55
Website

Re: Loading sprites into a specific area of the VRAM or something similar

ah thanks, this looks like it would do the trick, I am using GBDK.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson