I have a function, to initialise the game from the beginning
function init()
headerimg = LoadImage ( "header.png" )
headerplayimg = LoadImage ( "headerplay.png" )
header = CreateSprite ( headerimg )
headerplay = CreateSprite (headerplayimg )
endfunction
This init() is in case 1, of g_state. Now also in the above code, when the header sprite is pressed
if ( GetPointerPressed ( ) = 1 )
if GetSpriteHitTest(headerplay,getpointerx(),getpointery())=1
g_state = 2
delinit()
endif
endif
Delinit() is a function containing
function delinit()
DeleteSprite(headerplay)
DeleteSprite(header)
endfunction
When I try to launch, I get the error message
main.agc:42: error: Variable "header" is used without being defined or initialised
Do I need to use it in global or something? it is defined in the init() function.
Also, is this a good way of going from a title screen to a level selection, and then use something similar in case 3 to launch the actual game?
I have global g_State = 1 from the beginning, and I have the cases in a do---loop, like this
select g_state
case 1:
init()
endcase
///////
case 2:
playlevel()
endcase
///////
Thanks a lot, any help is appreciated