Theorical question about the sprites

SGDK only sub forum

Moderator: Stef

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Theorical question about the sprites

Post by Stef » Mon Feb 22, 2016 5:55 pm

This is how you *should* load the background data :

Code: Select all

        ind = TILE_USERINDEX;
        ...
        u16 ind1= ind ;
        VDP_loadTileSet(rebrol.tileset, ind, TRUE);				// tileset for first background is located at ind1
        map1 = unpackMap(rebrol.map, NULL);
        ind += rebrol.tileset->numTile;
        u16 ind2 = ind ;
        VDP_loadTileSet(rebror.tileset, ind, TRUE);				// tileset for second background is loaded at ind2	
        map2 = unpackMap(rebror.map, NULL);
        ind += rebror.tileset->numTile;

	// you only need these lines 
        VDP_setMap(VDP_PLAN_B, map1, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, ind1), 33,0 );
        VDP_setMap(VDP_PLAN_A, map2, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, ind2), 0,0 );
So here you can see tiles for planB are locatd at 'ind1' and tiles for planA are located at 'ind2'.
So now you can use tiles starting at 'ind' to store the sprites tiles (using 30000+ as index is crazy as it actually takes a tile index position and not a VRAM address ;) )

Post Reply