Jump to content

KeyHit()


Rick
 Share

Recommended Posts

Maybe this isn't a bug but it seems like a bug to me.If I have logic that doesn't let me hit the KeyHit(Key.F) line and I hit the 'f' key, and then I have logic that hits that KeyHit(Key.F) function in later frames, the action will happen even though I hit the 'f' key many frames ago. So this seems like hitting keys on the keyboard set some flag that it was hit but doesn't release that flag until KeyHit() is called. To me it seems like key hits should get released each frame. Does that make sense?

 

I know KeyHit() says the following (below) but is there a case where this behavior is really wanted vs having it reset each frame?

 

Returns true if the specified key is has been pressed since the last time it was checked, otherwise false is returned.

 

I know I can use KeyDown() but then for toggle behavior I have to make a boolean flag to go along with it. Should KeyHit() be that toggle behavior for us?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...