i am having problems with this code one function is placed outside main do loop and other one inside of it, the problem is that i can't draw a sprite on the screen and my program crashes with 'could not read memory at address' sort of error? here is the code
`load editor interface
function LoadInterface()
LegendImg=find free image()
load image "images/editor/legend.dds",LegendImg
LegendSpr=find free sprite()
LegendSpr=dxs create sprite from image(LegendImg)
LegendX=dxs get sprite center x(LegendSpr)
LegendY=dxs get sprite center y(LegendSpr)
dxs set sprite center LegendSpr,LegendX,LegendY
dxs set sprite filter LegendSpr,0
endfunction
`draw editor legend
function DrawInterface()
dxs begin sprite render LegendSpr
dxs draw sprite LegendSpr,screen width()-LegendX,screen height()-LegendY,0
dxs end sprite render LegendSpr
endfunction
what i want is to get this image in lower right corner of the screen