I am programming some movement for AI for a game based on angle and speed.Its a 2D program based on x,y axis. I currently have a position vector as-well as a velocity vector which accounts for speed and current direction of the AI.Every time I move the AI I just add the velocity vector to the current position to get my new position.At the moment the movement is 8-directional.What I wanted to implement was angle based movement (more realistic type of movement) and wondered if it is possible to calculate the velocity vector from an angle and speed constant.
Thanks in advance!
This better be possible.
This is how I envision your program works
position_X += velocity_X
position_Y += velocity_Y
Through trigonometry you can do
velocity_X = velocity*cos(angle)
velocity_Y = velocity*sin(angle)
A few things to keep in mind include