This has to do with direct input.
Now, I notice in some amatuer source code, or if the game works fine with this method, some people just go
(typing this in english, not code)
if button=left
else if button = right
else if button = left
ect
Now this leaves little for play, and one cannot move on diangols...
So A few if then statements would be nice, no else...the only else there should be on each if statement is to make sure the button is up.
Now how would one go about getting multiple directions. I have chosen a method, and seen a few others.
Here is my method, using c++ string
Direction is a string
The player pressed a button
if button = left then
Direction += Direction + "left"
if button = right then
Direction += Direction + "right"
Then we the motion is carried out I just
if (Direction.find("left",0) != string:npos)
move the stuff
Now I have also seen it done with ints, but an int representing a direcetion can get confusing to other programmers looking at yer stuff. I have seen individual key BOOLS for each key, which is consuming...Anyone have any nice methods they wish to explain.
Note: in my game I use north, south, east, west, up, down.
