Here's my code below. I'm trying to move a block 16 pixels across the screen every 5 seconds. In blitzmax I used the millisecs command but I'm not too clued up on GetTimerAll and how it works. Any help would be appreciated. :)
FUNCTION MoveTopBlock:
TBlockTimer = GETTIMERALL()
DRAWSPRITE 0, TBlockX, TBlockY
IF TBlockTimer >= (GETTIMERALL() / 1000) - (GETTIMERALL() + 5000)
TBlockTimer = GETTIMERALL() / 1000
TBlockX = TBlockX +16
ENDIF
PRINT TBlockTimer,0,0
ENDFUNCTION
Search on the forum for FPS (frames per second) for some tips!
a simple code:
LOCAL TBlockX = 100
WHILE TRUE
IF Timer < GETTIMERALL()
INC TBlockX,16
Timer = GETTIMERALL() + 5000
ENDIF
PRINT DrawDebugTimer(),10,10
PRINT "TEST", TBlockX, 100
SHOWSCREEN
WEND
END
FUNCTION DrawDebugTimer:
LOCAL timer
timer = MOD(GETTIMERALL(),5000)
RETURN timer
ENDFUNCTION
Thanks, Schranz0r. It works Perfectly. :)
no problem :)