Okay then... It's only a minor change, but for the completeness:
Text functions:
`*********************************************
`Text functions
`*********************************************
sync on
hide mouse
set text font "Comic Sans MS"
set text size 20
do
cls rgb(255,255,255)
`example of the effect1 function
effect1(0,0,"effect1",rgb(255,255,0),rgb(255,0,0))
effect1(120,20,"effect1",rgb(0,255,0),rgb(0,0,255))
`example of the effect3 function ( + reverse$ function)
textcolors(60,40,"textcolors")
textcolors(500,450,reverse$("textcolors"))
`example of the effect2 function
effect2(450,20,"effect2",0,rgb(255,0,0))
effect2(400,150,"effect2",rgb(255,255,0),rgb(0,255,0))
`example of the shadow function
shadow(2,20,"shadow",rgb(0,0,255))
`example of the circtext function
ink rgb(0,0,0),0
inc start,5 : if start>359 then start = 0
circtext(320,240,"circtext",25,start)
`example of the curvetext function
curvetext(320,320,"curvetext",25,15,start)
text 20,450,"normal"
sync
loop
`*******************************
`Text function by Sven Boulanger
`*******************************
`********************** return ************************
function mid2$(txt$,start)
return$ = ""
for x = start to len(txt$)
return$ = return$ + mid$(txt$, x)
next x
endfunction return$
function mid3$(txt$,start,length)
return$ = ""
if (start + length - 1) <= len(txt$)
for count = start to start+length - 1
return$ = return$ + mid$(txt$, count)
next count
endif
endfunction return$
function reverse$(txt$)
return$ = ""
for x = len(txt$) to 1 step -1
return$ = return$ + mid$(txt$, x)
next x
endfunction return$
function Cap(txt$)
return$ = upper$( mid$(txt$,1) ) + mid3$(txt$, 2, len(txt$)-1)
endfunction return$
`********************** colors ********************
function effect1(x,y,txt$,color1,color2)
redf = rgbr(color2) - rgbr(color1)
greenf = rgbg(color2) - rgbg(color1)
bluef = rgbb(color2) - rgbb(color1)
for i = 1 to len(txt$)
red = rgbr(color1) + (redf / len(txt$) * i)
green = rgbg(color1) + (greenf / len(txt$) * i)
blue = rgbb(color1) + (bluef / len(txt$) * i)
ink rgb(red, green, blue),0
text x + text width( mid3$(txt$,1,i-1) ), y, mid$(txt$, i)
next i
endfunction
function shadow(x,y,txt$,color)
ink rgb(5,5,5),0
text x-1,y+1,txt$
ink color,0
text x,y,txt$
endfunction
function effect2(x,y,txt$,color1,color2)
ink color2,0
text x-1,y-1,txt$ : text x-1,y,txt$
text x+1,y+1,txt$ : text x+1,y,txt$
text x,y-1,txt$ : text x,y+1,txt$
ink color1,0
text x,y,txt$
endfunction
`************************ Active text ***********************
function textcolors(x,y,txt$)
tx = text width(txt$)
for i = 1 to len(txt$)
repeat
color = rgb(rnd(1) * 255, rnd(1) * 255, rnd(1) * 255)
until color <> 0
ink color,0
text x + text width( mid3$(txt$,1,i-1) ), y, mid$(txt$, i)
next i
endfunction
function circtext(x,y,txt$,radius,start)
for i = 1 to len(txt$)
tx = cos((360 / len(txt$) * (i - 1)) - 90 + start) * radius
ty = sin((360 / len(txt$) * (i - 1)) - 90 + start) * radius
text x + tx, y + ty, mid$(txt$,i)
next i
endfunction
function curvetext(x,y,txt$,m,q,start)
for i = 1 to len(txt$)
ty = sin((m * i) - 90 + start) * q
text x + text width( mid3$(txt$,1,i-1) ), y + ty, mid$(txt$,i)
next i
endfunction
And the sprite functions:
`******************************************
`sprite functions
`******************************************
sync on
`Make sprites:
cls
for i = 1 to 25 step 5
ink rgb(255 - (i * 10),255 - (i*10),255 - (i*10)),0
circle 25,25,25-(i)
next i
get image 1,0,0,50,50
for x = 1 to 20
sprite x,0,0,1
next x
do
`clear screen
cls rgb(255,255,255)
`example of the centersprite function
centersprite(1,mousex(),mousey())
`example of the circsprite function
inc start,2
if start > 359 then start = 0
circsprite(2,10,320,240,80,start)
spritewave(11,20,10,80,20,30,start)
sync
loop
`*********
`functions
`*********
function centersprite(spr,x,y)
if sprite exist(spr)
sx = sprite width(spr) / 2
sy = sprite height(spr) / 2
sprite spr, x - sx, y - sy, sprite image(spr)
endif
endfunction
function circsprite(spr,to_spr,x,y,radius,start)
range = to_spr + 1 - spr
for i = 0 to range - 1
posx = x + cos((360/range*i) - 90 + start) * radius
posy = y + sin((360/range*i) - 90 + start) * radius
centersprite(spr + i,posx,posy)
next i
endfunction
function spritewave(spr,to_spr,x,y,m,radius,start)
range = to_spr + 1 - spr
for i = 0 to range - 1
if i = 0
posx = x
else
posx = sprite x(spr + i - 1) + (sprite width(spr + i - 1))
endif
posy = y + sin((m*i) - 90 + start) * radius
sprite spr + i,posx,posy,sprite image(spr + i)
next i
endfunction
Immunity and Annihalation makes Immunihalation...