Simple code for WASD Movement?

Now i'm less than a noob at this but I'm really trying to learn. I've watched countless of youtube tutorials trying to undersstand everything but they go to fast and just assume everyone knows everything already.

I just want it explained to me. I'm using unity, 2d trying to make my character just move left and right and maybe even jump. I know it seems simple but you gotta start somewhere.
You might have better luck on a Unity forum.
the first issue is that c++ does not have by default a tool to read the keyboard without the user pressing enter each time. You have to make one or use a nonstandard one like getch.

So start there: write a little program that gets the input and writes something for now, eg if(input== 'w') cout << "up\n";
and see if you can knock that out.
once you have this part, you just need to connect it to your graphics, and move your camera or objects accordingly when you get the input. That part is where you need to know how to use unity or get some help from their documents/forums/etc.

unity itself may have something like getch for you to use. If so, you can use that too; does not matter what flavor just see if you can get this part down in a text/simple test program. Start small, work it up, is the idea... getting rid of the graphics will let you solve a piece of it easily and then do another piece...
Last edited on
Hello, isn't that what you're looking for to start with?

http://www.cplusplus.com/forum/general/55170/
Last edited on
Topic archived. No new replies allowed.