Check for a key hit

Just starting out? Need help? Post your questions and find answers here.
lucid
New User
New User
Posts: 5
Joined: Wed Nov 03, 2004 11:40 pm

Check for a key hit

Post by lucid »

Hi, Ive searched the forums and couldnt find anything on this.

I am trying to find a way to determine if an arrow key has been hit, not "pressed down" and not "released"

In other words im not looking for KeyboardPushed, or KeyboardReleased.... I wish there was a KeyboardHit.

How can I simulate this for the arrow keys? The moment an arrow key is hit, i want a value to change but not continuously change if the user holds the key down.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Re: Check for a key hit

Post by Dare2 »

Hi lucid

Could you do this?

Create a variable you use as a flag.

If key pushed (arrow key) and flag is 0, then set flag to 1 and change the value you want to change.

If key released set flag to 0

Otherwise do nothing.
@}--`--,-- A rose by any other name ..
lucid
New User
New User
Posts: 5
Joined: Wed Nov 03, 2004 11:40 pm

Post by lucid »

Hey thanks Dare2!

odd enough I was just trying the same thing just now.

Would be really nice to have a KeyHit feature to avoid the extra flag programming.

Guess it doesnt really matter though.
Post Reply