Im trying to make a view follow a plyayer smoothly without leaving a specific space on the screen like so:

So far I have got up to a simple script like this:
/* Arguments
*argument0 = base object
*argument1 = object to follow
*argument2 = max distance
*/
//Reasign
base_obj = argument0;
follow_obj = argument1;
max_dist = argument2;
//Create
dist = abs(base_obj.y - follow_obj.y);
speed_dif = follow_obj.vspeed - base_obj.vspeed;
if (dist < max_dist) {
base_obj.vspeed -= 0.1;
}if (dist > max_dist) {
base_obj.vspeed += 0.1;
}else {
base_obj.vspeed = follow_obj.vspeed;
}This works in a way that one object with follow the other precisly but I want it to follow smoothly like stated above
Here is an example of what ive got:
Example
Any help or questions just say!
Ty in advance!
-Thaiscorpion
Edited by thaiscorpion, 27 June 2012 - 04:49 PM.











