I am trying to use the following code to create a sprite of some text which will show over the top of the other sprites:
function TextOverSprite(nSpriteNumber,nX,nY,sText$)
create bitmap 1,screen width(),screen height()
text 0,0,sText$
get image nSpriteNumber,0,0,text width(sText$),text height(sText$),1
delete bitmap 1
sprite nSpriteNumber,nX,nY,nSpriteNumber
endfunction
This works fine in one insidents but when I load the other page which uses it, I am told that runtime error 504 has occured due to an illegal area in the get image line.
This is the code which must be breaking it:
nCounter = timer()
repeat
for c = 501 TO 516
d = c - 500
if nSelectedTxtBox = c
TextOverSprite(c + 300,sprite x(c) - (sprite width(c) / 2) + 5,sprite y(c) - 15,aPlayers(d).sName + "|")
else
TextOverSprite(c + 300,sprite x(c) - (sprite width(c) / 2) + 5,sprite y(c) - 15,aPlayers(d).sName)
endif
next c
if nSelectedTxtBox = 533
TextOverSprite(833,sprite x(533) - (sprite width(533) / 2) + 5,sprite y(533) - 15,sTeamOne + "|")
else
TextOverSprite(833,sprite x(533) - (sprite width(533) / 2) + 5,sprite y(533) - 15,sTeamOne)
endif
if nSelectedTxtBox = 534
TextOverSprite(834,sprite x(534) - (sprite width(534) / 2) + 5,sprite y(534) - 15,sTeamTwo + "|")
else
TextOverSprite(834,sprite x(534) - (sprite width(534) / 2) + 5,sprite y(534) - 15,sTeamTwo)
endif
until timer() - nCounter > nTime
This is the code where it works successfully:
set cursor 5,screen height() / 4 * 2
print "You survived to round ",nLevel,"!"
if nLevel > 1
TextOverSprite(1000,5,screen height() / 4,"Your quickest time was")
TextOverSprite(1001,5,screen height() / 4 + 25,"0." + str$(aPlayers(1).fSpeed) + " seconds!")
endif
Any suggestions on which part of this might be the illegal area?
Thanks for your help,
Lucas