F
fxokz
Guest
Im trying to make it so that when a portal is created the view moves towards the portal fast at first but gets slower the closer it gets. Ive sort of achieved this effect but it still doesnt feel like the speed is decreasing enough. code;
Do you guys know how i can make it start off faster but decrease right after?
Code:
if instance_exists(obj_portal)
{
dir = point_direction(x, y, obj_portal.x, obj_portal.y);
dist = point_distance(x, y, obj_portal.x, obj_portal.y);
if (dist) < 5
{
x = obj_portal.x;
y = obj_portal.y;
} else {
hspeed = 20 * dcos(dir)/5;
vspeed = -20 * dsin(dir)/5;
}
}