The key factor in the problem is to create a bitmap and print the text onto it. then copy the bitmap to the screen.
download the full program. it display 101 sprites on the screen while the FPS is still as set by Sync rate 60.
control the arrow sprite with arrow keys.
set display mode 640,480,32
anytext$ = "Hi Pincho, thanks for your reply, but I don't think I have explained myself properly. I don't want to replace text with sprites, I want to display text in one part of the window, and add separate sprites to a different part of the window, both being displayed simultaneously. The problem displaying text and sprites on a screen simultaneously is that as the page syncs, the text will disappear unless it is placed in a loop. Using the word wrap function does not enable the text to be placed in a loop, hence when the screen redraws, the sprites remain but the text vanishes. If I use e.g bitmaps for the images then i can display text and images simultaneously, but I require the images to be copied into sprites. This is my dilema ! Hope that makes it clearer. Thanks."
create bitmap 1,640,480
print_line_in_multiple_lines(anytext$, 80)
set current bitmap 0
load image "arrow.bmp",1
sprite 1,320,300,1
load image "ball.bmp",2
for sp = 2 to 100
sprite sp,rnd(640),rnd(480),2
size sprite sp,30,30
set sprite alpha sp,125
NEXT
draw to back
sync rate 60
start_time = timer()
do
running_time = timer()
if running_time - start_time > 2000
for sp = 2 to 100
sprite sp,rnd(640),rnd(480),2
NEXT
start_time = timer()
ENDIF
sprite 1,sprite x(1)+rightkey()-leftkey(),sprite y(1)+downkey()-upkey(),1
copy bitmap 1,0
set cursor 10,400 : print "screen rate: " + str$(screen fps())
LOOP
end
function print_line_in_multiple_lines(text$, line_length)
line$ = first token$(text$," ")
repeat
token$ = next token$(" ")
if len(line$+token$) > line_length
print line$
line$ = token$
else
line$ = line$+" "+token$
ENDIF
UNTIL token$ = ""
print line$
endfunction
