Keyhit:
This command returns the number of times a specified key has been hit since the last time you called the KeyHit() command. Check the ScanCodes for a complete listing of scancodes.
This command returns the number of times a specified key has been hit since the last time you called the KeyHit() command. Check the ScanCodes for a complete listing of scancodes.
The trick would be to set up your keyboard polling routine so that you know how long has passed between tests. e.g. only call the testing function once per second.
Something like this...
Graphics3D 800,600 cam = CreateCamera() cube = CreateCube() message$ = "use 'P' To punch" While Not KeyDown(1) timer = MilliSecs()-oldtimer If timer > 1000 oldtimer = MilliSecs() message$ = DetermineAction() EndIf PositionEntity cube, Rnd(20)-10, Rnd(20)-10, 20 RenderWorld Text 100,100,message$ Flip Wend Function DetermineAction$() Select KeyHit(25) Case 0 Return "use 'P' To punch" Case 1 Return "punch" Case 2 Return "superpunch" Case 3 Return "sliding punch" Default Return "haymaker" End Select Return "error" End Function