to supplement what he said...
the basis of a function is a piece of code the runs through once when you call it...the other thing is that it ignores all of the variables in your program that aren't global(I.E. you could have a variable named "health" inside your function and outside your function, but they wouldn't bump into each other...)
like this...
make object cube 1,10
do
move_player()
loop
function move_player()
move object 1,1
endfunction
but there is more to a function then that, you can also "pass" variables to it...(Note: any none global variables that you mess around with in a function don't get changed when you exit the function.)
like this...
make object cube 1,10
speed=1
do
move_player(speed)
inc speed
loop
function move_player(rate)
rate=rate-1
move object 1,rate
endfunction
in this example the "player" object would get faster and faster...but the rate it moved would always be one less then the variable "speed"...
now say you want to know something about the results of what you did in your function(maybe it performs a calculation?) to do so you can either change global variables or use the "return vaiable"
like this...
make object cube 1,10
speed=1
do
value=move_player(speed)
inc speed
text 20,40,str$(value)
text 20,60,str$(speed)
loop
function move_player(rate)
rate=rate-1
move object 1,rate
endfunction rate
now the "rate" variable's value at the end of the function is passed to the variable named "value"; and then they are both printed onto the screen...if you run this(DBPro but i haven't tested) the number on top(rate) should be one less then the number on bottom(speed)...
that's pretty much the basics of functions...i gotta go but feel free to ask more questions...
"We make the worst games in the universe."