View Following problem

Non-platform specific questions.

View Following problem

Postby Hblade » Sun Jun 03, 2012 3:04 am

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: View Following problem

Postby skydereign » Sun Jun 03, 2012 3:32 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: View Following problem

Postby Hblade » Sun Jun 03, 2012 4:04 am

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"
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: View Following problem

Postby lcl » Sun Jun 03, 2012 9:00 pm

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
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: View Following problem

Postby Hblade » Sun Jun 03, 2012 9:34 pm

hmm, I think I understand now!
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest