![]() |
Keydown event? (Not onKeyPressed)
I'm trying to find a way to detect when a key is pushed down, and not when it's pressed (onKeyPressed). The effect would basically be the same as onKeyPressed, but without the auto-repeat most operating systems implements.
From searching the forums, I've found that onKeyDown and onKeyUp apparently can be used in GUI controls, but none of them works in a standard "weapon". (Declaring onKeyUp() and KeyUp()) My goal is to call a function when a key is tapped twice within a specified timespan. At first I did this with onKeyPressed and timevar2, but previously mentioned auto-repeat messed that up, calling the function repeatedly when the button was held down. As an alternative, I thought about checking for the keys in onTimeout(), but the way I constructed it, it would limit the timespan to a minimum of 0.1. (Not allowing the player to double press faster than that) |
OnKeyDown works with only like 10 buttons if I remember correctly, though maybe I'm wrong :/
keydown( key ) the specified key is pressed (0..10:up,left,down,right,S,A,D,M,tab,Q,P) |
Quote:
|
0.1 seconds is pretty damn fast... Keep it like you have it and you should be just fine.
(And it isn't really 0.1...it is actually >0.05 since they just have to have the key released by the next 0.05 timeframe...after that frame they can press it again even if it is at 0.06 seconds) |
| All times are GMT +2. The time now is 05:42 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.