Creating toggling keyboard pause button

Blitz3D Forums/Blitz3D Programming/Creating toggling keyboard pause button

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I want to implement a keyboard toggle, press Space to pause animation, press Space again to continue. Reading the keyboard with keydown(), it's often the case the Space is down for longer than one iteration of the game loop, causing a pause and unpause when pressed and released. I've added a dealy (wait 150 ms after pressing key) along with flushing the keyboard, but it's far from ideal.

Any ideas on a nicer way to do this?

EDIT : I could always try KeyHit() instead! Doh!