I havent looked at your code but this works for my mini map in my raycaster.
I use one single sprite for everything!
function Draw_MiniMap (scalex,scaley,Screen_X,Screen_Y)
REM // Initiate and setup
/////////////////////////
if getspriteexists(MapSpr)=0
REM // only done the first time this function is used
REM /////////////////////////////////////////////////
GLOBAL Mapimg
GLOBAL MapSpr
MapSpr = CreateSprite ( 0 )
setspritedepth( MapSpr ,0)
else
REM // A simple cleanup with a fresh sprite
REM ///////////////////////////////////////
deletesprite( MapSpr )
MapSpr = CreateSprite ( 0 )
setspritedepth( MapSpr , 0 )
endif
REM // Lets create our min map border
REM /////////////////////////////////
SetSpriteSize ( MapSpr , scalex * RE_Map_X , scaley * RE_Map_Y )
SetSpritePosition ( MapSpr , Screen_X , Screen_Y )
SetSpriteColor ( MapSpr , 155 , 155 , 155 , 255 )
DrawSprite( MapSpr )
REM // Lets create our min map background
REM /////////////////////////////////////
SetSpriteSize ( MapSpr , (scalex * RE_Map_X)-(scalex*2) , (scaley * RE_Map_Y)-(scaley*2) )
SetSpritePosition ( MapSpr , Screen_X+scalex , Screen_Y+scaley )
SetSpriteColor ( MapSpr , 255 , 255 , 255 , 255 )
DrawSprite( MapSpr )
REM // Generate the rest of the map
REM ///////////////////////////////
for y = 1 to RE_Map_Y-2
for x = 1 to RE_Map_X -2
if map [ x , y ]._Type >= 1 and map [ x , y ]._Type <= 5
SetSpriteSize ( MapSpr , scalex , scaley )
if map [ x , y ]._Type = 1 then SetSpriteColor ( MapSpr , 155 , 155 , 155 , 255 )
if map [ x , y ]._Type = 2 then SetSpriteColor ( MapSpr , 55 , 155 , 155 , 255 )
if map [ x , y ]._Type = 3 then SetSpriteColor ( MapSpr , 155 , 55 , 155 , 255 )
if map [ x , y ]._Type = 4 then SetSpriteColor ( MapSpr , 155 , 155 , 55 , 255 )
if map [ x , y ]._Type = 5 then SetSpriteColor ( MapSpr , 55 , 155 , 55 , 255 )
SetSpritePosition ( MapSpr , Screen_X + (x*scalex), Screen_Y + (y*scaley) )
DrawSprite( MapSpr )
MiniMap[ Cube ] = MapSpr
endif
next x
next y
Mapimg = GetImage( Screen_X, Screen_Y, RE_Map_X*scalex, RE_Map_Y*scaley )
SetSpriteColor ( MapSpr , 255 , 255 , 255 , 255 )
setspriteimage(MapSpr,Mapimg)
setspritedepth( MapSpr ,1)
SetSpritePosition ( MapSpr , Screen_X , Screen_Y )
SetSpriteSize ( MapSpr , RE_Map_X*scalex , RE_Map_Y*scaley )
endfunction
For some reason whas i forced to make the sprite depth to 0.
And i dont nead to use the render() command as it draws this on top and then grabbs it!