Page 1 of 1

how to have view follow actor

PostPosted: Tue May 23, 2006 6:54 pm
by frodo
I have an actor controlled by the arrow keys. how can I make the view follow my actor only horizontaly, not verticly?

PostPosted: Tue May 23, 2006 7:32 pm
by makslane
You can try this:

In the 'Draw Actor' event of view, put this script:

x = player.x - width/2;

To put some elasticity:

x = ((player.x - width/2) + 9*x)/10;

PostPosted: Tue May 23, 2006 8:56 pm
by frodo
Thanks, Makslane. I liked your elasticity thing!

PostPosted: Wed May 24, 2006 6:27 am
by Troodon
x = ((player.x - width/2) + 9*x)/10;



Me too, I've allways loved those tricks!

PostPosted: Wed May 24, 2006 8:03 am
by DilloDude
Be careful about moving the view all the time though; it can cause a decrease in performance.