Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mittens

Direction Key Help

This topic is 6341 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone. I am currently making a little "game" (I use that word loosely ). And I don''t want to touch DX yet... And I need to know how to code the ASCII code (or whatever) to get my program to recognize that they are being pressed... So, can someone please help me? Thnx in advance! ^_^ ------------------------------ The Shining Knight

Share this post


Link to post
Share on other sites
Advertisement
You could check the Windows Message Handler for WM_KEYDOWN messages. If there is one, check which key it is using CASE then call the appropriate code. You can do the same for WM_KEYUP (key released) messages.

Sorry - I can't get you an example right now, but you can at least look up Windows Messages / Message Handlers in the compiler help - that should get you started.

Paulcoz.

Edited by - paulcoz on January 10, 2001 8:15:45 PM

Share this post


Link to post
Share on other sites
quote:

And I don''t want to touch DX yet... And I need to know how to code the ASCII code (or whatever) to get my program to recognize that they are being pressed...



Ah, I know EXACTLY where you''re coming from -- and let me tell you: crime doesn''t pay...

Anyway, UP, DOWN, LEFT, and RIGHT are strange 4-bit ASCII codes or something, so they aren''t accessible through standard or extended ASCII character codes. No way to just throw a
  
if ( kbhit() )
{
getch() == UP_ARROW moveUp(); // and there was much rejoicing

}

Believe you me, I spent a good half my summer (well, maybe a few days) figuring out there''s no way.

Use W, A, D, and S. They are the next-most-standard thing to the arrow keys.

-----------------
The Goblin
-----------------
"Oh, God..."
"Yes?" <- My Response

Share this post


Link to post
Share on other sites
Heh heh heh. The previous code example doesn''t even make sense. I''m tired.

Well, about as much sense as the exchange between my brother and I:

Him: "Wow, I''d like to wash a hat with this..."
Me: (menacingly)"Oh yeah? Well I''d like to wash YOU -- Wait, NO!"

-----------------
The Goblin
-----------------
"Oh, God..."
"Yes?" <- My Response

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!