How can I make a character move forward in a certain direction?
- by Shaun Wild
I have an entity class which is updated every game tick. Let's just assume said entity moves forward constantly. What i want to know is, how can i make it so that i can give an angle to a function and it will make my entity move in that direction. let's say for example
moveForward(90);
Would make my character move to the right, or for example declaring my rotation as a global Integer:
moveForward(rotation);
rotation++;
Would make my entity move around in a small circle, I assume this includes some kind of vector math, which I haven't done any studying on so a brief explanation of that if it's necessary would be nice.
I would appreciate a small code snippet and an explanation I can analyze, thanks in advanced :)