Function not fonctionning? lol

Blitz3D Forums/Blitz3D Beginners Area/Function not fonctionning? lol

...
Frames    =  12
AnimDelay = 120

;-----------------------------------------
; MAIN LOOP
While Not KeyDown(1) Or quit = True 

If Draw_Samus = 1 Then
DrawImage SamusSprites,0,0,Frames
ini_Samus()
EndIf


Flip:Cls
Wend

End
....
;-----------------------------------------
; FUNCTIONS
Function ini_Samus()
		If Frames = 22 Then Frames = 12

			If TheTimer+AnimDelay < MilliSecs() Then
  				TheTimer = MilliSecs()
  				Frames = Frames + 1
			End If
End Function


If I take the stuff in the function and replace the ini_Samus() in the loop it works but if I put the ini_function it doesnt work I dont understand got any idea?

The variables used in the function need to be global. If they are not made global the function treats them as new local variables.

just put

global thetimer
global frames

at the top of your program and this should work

made it work.. Thanks guys
also I needed Global AnimDelay