This is the first of the series of tutorials on how to do character movement anywhere on the screen using Vectors. So essentially we are going to learn vectors, which are used everywhere in video games and are very important.
Lets say you have a character (ex Pacman) on the screen and you want to move him across your screen along to the right.
In PHYSICS: We can consider this as the velocity of Pacman. Velocity is represented by . The little arrow on top denotes that is a vector. A vector is an angle and a length denoted by =(θ, L). A long vector means the character is moving fast and a short vector means the character is moving slow. =(θ, L) is the way vectors are represented in physics.
In game development, the above notation for vectors is difficult to store and so we use the x and y coordinates to represent vectors.
If P(x, y) is the current position of Pacman and P’ is the new position, then P’ is the sum of old position and velocity.
P’= (Px+vx, Py+vy)
P’ is now the new position that Pacman needs to go to !