It is worth noting that until the entire code itself is loaded, nothing will happen. I do not use 'Loading' indicators typically because unless your code is like 10,000 lines long, or has 150 models / textures / songs / etc., it will load in only a few seconds anyway.
Still, to help you out, I've written a short snippet of code to demonstrate one way you could do it. It is not the most elegant, but will do the job. The idea is to call a function to display a loading bar after you make initial function calls or gosub subroutines when the game is first loading/setting up. In this code, I use a variable, LoadPCT, to contain a value of what percentage of the game has been loaded. I then use this variable in a function to display a yellow bar indicating how much of the game has loaded.
I put some dummy functions in place to show you the idea:
rem STILL loading LBFN 8 July 2013
sync on : sync rate 60
global LoadPCT
LoadPCT = 10 : ShowPCT()
LoadImages()
LoadPCT = 25 : ShowPCT()
SetupPlayer()
LoadPCT = 50 : ShowPCT()
SetupNPCs()
LoadPCT = 75 : ShowPCT()
LoadMAP()
LoadPCT = 100 : ShowPCT()
repeat
ink rgb(0,0,255),0
text 200,200,"Game is fully loaded"
text 200,220,"Press [SPACEBAR] to exit."
sync
until spacekey() = 1
end
function LoadImages()
rem normally will load images here
rem put in 3/4 second delay for now
wait 750
endfunction
function LoadMAP()
rem normal would load in map data here
wait 750
endfunction
function SetupPlayer()
rem normally will assign player attributes here
wait 750
endfunction
function SetupNPCs()
rem normally will assign enemy attributes here
wait 750
endfunction
function ShowPCT()
ink rgb(0,0,0),0
box 200,0,300,12
ink rgb(255,255,0),0
text 100,0,"Loading:"
box 200,0,200 + LoadPCT,10
sync
endfunction
It is a short example, but it should give you a way to do this.
So many games to code.....so little time.