Page 1 of 1

View follows smoothly

PostPosted: Mon Feb 19, 2007 3:00 pm
by Troodon
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. :P

PostPosted: Mon Feb 19, 2007 3:06 pm
by Troodon
I found already one good which uses a invicible actor with this draw actor code:
Code: Select all
int weight = 20;

y = ((height - 1)*y + vene.y)/height;
 x = ((width - 1)*x + vene.x)/width;


Someone has something more beautifull?

PostPosted: Tue Feb 20, 2007 2:42 am
by Sgt. Sparky
After I fix my GE, I will show you a four way move :D
(The window got Deactivated, and when I clic kon it it beeps :cry: )

PostPosted: Tue Feb 20, 2007 10:25 am
by Troodon
Ok, thanks. :D
I hope you can fix your GE soon. :wink:

PostPosted: Tue Feb 20, 2007 11:36 pm
by Sgt. Sparky
I just fixed it! :D
here is a four way code for the view actor,
it makes the view act like it is a camera fallownig a person :D
See my Roborunaway base game:
http://game-editor.com/forum/tp-3071-Robo-baseGame.html
:D
well,
make an actor that fallows the Player with this code for the draw actor Event for your player:
Code: Select all
KnightPointer.xscreen = xscreen;
KnightPointer.yscreen = yscreen;

and here is the draw actor event for an actor that the view fallows(The vies parent actor, like ViewParent.):
Code: Select all
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;
}

I hope it helps! :D

PostPosted: Wed Feb 21, 2007 10:36 am
by Troodon
Thanks, I will try it. :)