• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

Windows how to get keY DOWN frequenc?

tomlee2020

Member
i wan to make plane game.if i fast key down.the plane fast shoot .if i slow key down.the plane slow shoot.
i think if i can get keY DOWN frequenc.it is easy design code.but i do not know how to get keY DOWN frequenc
who can help me? thank you!
 

FoxyOfJungle

Kazan Games
It is not possible to detect the "frequency" of pressing the key, the key only returns binary value 1 and 0 (true and false).

What you can do is create a time variable, if the key is pressed you reset the time, if you continue pressing it will increase the variable until it reaches a certain value (which is the time), so you will shoot and reset the time again.
 

tomlee2020

Member
[QUOTE =“ FoxyOfJungle,帖子:480242,成员:31608”]
无法检测到按下键的“频率”,该键仅返回二进制值1和0(正确和错误)。

您可以做的是创建一个时间变量,如果按下该键,您将重置时间,如果继续按下,它将增加该变量,直到达到某个值(即时间)为止,因此您将拍摄并重置时间再次。
[/引用]
Can you give code.thank you.
 
Top