Page 1 of 1

View Following problem

PostPosted: Sun Jun 03, 2012 3:04 am
by Hblade
So I have an issue with the view following my player. I had GAGGs setup in the "Perfect Collision" exapmle, but for some reason my view ALWAYS shakes when scrolling Vertically. I've tried editing things around, but no luck.

I want the view to follow my actor in that kind of manner but without that annoying shake problem >.>

Please help someone :) i've tried a different method that resulted in no luck

Re: View Following problem

PostPosted: Sun Jun 03, 2012 3:32 am
by skydereign
You'll have to give us the code or something, as Game A Gogo's example works very nicely. So saying it doesn't work for you only tells us one of two things. You messed up somewhere, or you used it in a way that wasn't intended.

Re: View Following problem

PostPosted: Sun Jun 03, 2012 4:04 am
by Hblade
Yeah it does.

And your right, I should have given code. I've already gone to anothe rmethod now, one more original to the style of game I'm making and also easier to manage "stages"

Re: View Following problem

PostPosted: Sun Jun 03, 2012 9:00 pm
by lcl
In this kind of problems you must try to "think" like the computer does and go through all the code you have that may affect the result of the code.

For example the shaking of the screen when following player is most usually caused by the screen moving over the coordinates it is supposed to move to and then getting back but because the speed is too high it goes too much back and it won't settle down, but instead shake around the position it is supposed to move to.

Like:
Your view moves with speed 5 pixels / frame, so yvelocity = 5.
If it should stop to y coordinate 17 and it is currently in y coordinate 15 it will jump to 20 and then it will think "oh I'm too far", go 5 pixels back to 15 and think again "oh I'm too far", etc. :D To avoid this make it either slow down its speed when it's closer or make the point where you want the view to go to have a bigger area around it where it can stay. So like that it can stop even 3 pixels away from the target. That way you can avoid the shaking.

That was just an example, but do this, put yourself to the place of the computer and try to think what happens if you carefully follow the rules you've given in your code :D

Re: View Following problem

PostPosted: Sun Jun 03, 2012 9:34 pm
by Hblade
hmm, I think I understand now!