Hi,
How can I make the view follow smoothly my main actor. I don't want to make my actor the parent of the view, because in my game there is places where you wouldn't notice you are moving. I know there is some very beautifull codes here.
int weight = 20;
y = ((height - 1)*y + vene.y)/height;
x = ((width - 1)*x + vene.x)/width;
KnightPointer.xscreen = xscreen;
KnightPointer.yscreen = yscreen;
if(x < KnightPointer.x - 50)
{
xvelocity = Knight.directional_velocity+ .1;
}
if(x > KnightPointer.x + 50)
{
xvelocity = - Knight.directional_velocity - .1;
}
if(y > KnightPointer.y + 50)
{
yvelocity = - Knight.directional_velocity - .1;
}
if(y < KnightPointer.y - 50)
{
yvelocity = Knight.directional_velocity + .1;
}
if(distance(x, y, Knight.x, Knight.y) < 50)
{
directional_velocity = 0;
}
Users browsing this forum: No registered users and 1 guest