keyhit() is not 100%

Blitz3D Forums/Blitz3D Beginners Area/keyhit() is not 100%

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.

Is this method of programming incorrect?


Yup. Call the keyhit function once and it resets the current keyhit value for the key you are checking against.

To do your example above you could use a select case statement or more if's

if keyhit(28)
   if a=0 value=true
   if a=1 value=false
endif


Both methods will be faster (less key checking) and the code will be cleaner/ easier to change. For example if you want to change the key you use for this task you would have to go through a lot of commands replacing the vlaue. In the example above you would just have to do it once.