I've always had a problem with KeyDown:
Suppose I want to exit from the 3D scene back to the main menu by pressing the Escape key.
Once I'm on the main menu then pressing Escape would trigger the 'Exit' question.
The trouble is that any function I write always 'drops through' no matter how many times I use FlushKeys.
Here's a simple example:
[CODE]
Repeat
FlushKeys
If KeyDown(57)
Print "Key Down"
While KeyDown(57)
Wend
Print "Key Up"
EndIf
Until KeyDown(1)
End
[/CODE]
The first time the spacebar is pressed Blitz just drops through the While KeyDown(57) loop.
While KeyDown(whatever) just can't be trusted.
Does anyone have a tried and tested method of 'holding until no key is pressed'?
Suppose I want to exit from the 3D scene back to the main menu by pressing the Escape key.
Once I'm on the main menu then pressing Escape would trigger the 'Exit' question.
The trouble is that any function I write always 'drops through' no matter how many times I use FlushKeys.
Here's a simple example:
[CODE]
Repeat
FlushKeys
If KeyDown(57)
Print "Key Down"
While KeyDown(57)
Wend
Print "Key Up"
EndIf
Until KeyDown(1)
End
[/CODE]
The first time the spacebar is pressed Blitz just drops through the While KeyDown(57) loop.
While KeyDown(whatever) just can't be trusted.
Does anyone have a tried and tested method of 'holding until no key is pressed'?