Jump to content
  • Advertisement
Sign in to follow this  
andfol

Player movement with keyboard

This topic is 2475 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

Hi,

I am implementing a game in OpenGL on windows, I have a window with two players in it, these are drawn in OpenGL. I want to know how to put movement on these players with the keyboard?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
You can catch messages for keypresses, but I don't think that will be right for you in all honesty. If you just want to check something now you could also use this:


GetAsyncKeyState(VK_DOWN);


Where VK_DOWN is the down arrow key on your keyboard. check here for more info.

However, I would do as jbadams says. It's clear you're new to programming and the above methods is something more advanced, or in the GetAsyncKeystate, limiting to a certain degree. Use something like SDL as he suggested, or if you don't want to use something of an API, check out glut.

Share this post


Link to post
Share on other sites
I will be using GetKeyState(VK_UP) just wanted a function that will move my player within an if statement in a function using the key state.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!