Functions are very useful things. They are like GoSub but can have "variables" attached to it.
here is an example:
function advancedprint(a$,x,y)
center text x,y,a$
endfunction
to call a function it is quite simple:
advancedprint("hello world!",20,20)
The above code will print hello world at the coordinates of 20 and 20.
so how do you apply this to your games?
Well there is several ways to!
This code will load and texture and place an object.
function placeobject(number,model$,x,y,z,texture$)
load object model$,number
load image texture$,number
texture object number,number
position object number,x,y,z
end function
This one will delete an object from the screen:
function removeobject(number)
delete object number
endfunction
as you can see there are many ways to use functions.
you can also make an inventory or declare items using arrays/types
function AddWeapon(number,clips1,ammo1,maxammo1,name$ , rate1)
weapon(number).ammo=ammo1
weapon(number).maxammo=maxammo1
weapon(number).name=name$
weapon(number).rate=rate1
weapon(number).clips=clips1
endfunction
functions are very easy to use. Make any requests on how to make something with functions on this post and i will help