The Daily Click ::. Forums ::. Klik Coding Help ::. Problem with dragging camera.
 

Post Reply  Post Oekaki 
 

Posted By Message

Tokinsom



Registered
  22/11/2009
Points
  25
30th November, 2009 at 22:13:26 -

Hey everybody. I've asked this question a few times on the clickteam forums but no one seems to be helping. Hopefully somebody here might have a bit more input

Anyway, I've made a dragging camera for my platform game using the Advanced Direction Object...specifically:

IF: Distance between 0,0("camera") and 0,0 ("player") is <=
LongDist( "Advanced Direction Object", X( "camera" ), Y( "camera" ), X( "player" ), Y( "player" ))

THEN: Set maximum speed of ("camera") to: LongDist( "Advanced Direction Object", X( "camera" ), Y( "camera" ), X( "player" ), Y( "player" ))
THEN: ("camera") look in direction of 0,0("player")

It works great and all, but when my player gets near the middle of the frame and the screen starts scrolling, the camera makes him shake left and right for some reason. It's not very noticeable unless in full screen but either way it's driving me nuts lol.

I can upload an example if needed..though it only takes 5 minutes to reproduce the issue.. Also if it means anything, I'm using the Platform Movement Object for my player.

Thanks for any help.



 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
30th November, 2009 at 23:42:39 -

Did you try unhiding all the objects and displaying all possible values, and take advantage of the debug menu in the top left corner of the screen when running? These are all pretty critical debugging elements. I'm sure if you upload an example, you'll get feedback pretty quickly.

 
http://www.facebook.com/truediamondgame

Tokinsom



Registered
  22/11/2009
Points
  25
1st December, 2009 at 00:46:13 -

Yes, the only thing I noticed was the speed of the camera flickers between 2 numbers once my player gets far enough from the camera.(The camera uses the ball movement) This could be the issue but I'm still not sure how to go about fixing it.. I'll upload an example in a bit.

Edited by Tokinsom

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
1st December, 2009 at 01:38:34 -

Well until I know what the actual problem is, I'm sure just by what you told me right now, theres probably an easy work around. For example, maybe you could place a cap on the value or limit it from going up to a specific variable by adding in "If lower than" into the conditions.

 
http://www.facebook.com/truediamondgame

Tokinsom



Registered
  22/11/2009
Points
  25
1st December, 2009 at 02:14:13 -

Here's an example: http://www.mediafire.com/?imdjojiwznv
(arrow keys to move, S to jump)

Again.. when scrolling, the dragging camera for some reason shakes the yellow player object left and right.. I've tried different methods for a dragging camera but the same thing happens with each one. I've tried swapping around the conditions and actions as well but no results :\ Thanks for any help.

 
n/a

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
2nd December, 2009 at 10:21:26 -

If you slow the frame rate down and turn off the camera completely, you will see that the movement of the player does not travel in exactly pixel by pixel movement, and every 5th step or so it moves by 2 pixels, and i'd guess that this is preventing the camera from matching up to the player on these frames. I thought I had a solution before but its now escaped me....

Edited by Rox Flame

 
Current project:
Dynabrick (%70)

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
2nd December, 2009 at 17:22:33 -

Ok, I checked it out. There is nothing wrong with the camera. There is something wrong with the player movement.
And since I am inexperienced with the PMO object I can't help you. Ask adam.

Edited by UrbanMonk

 
n/a

Tokinsom



Registered
  22/11/2009
Points
  25
3rd December, 2009 at 05:59:18 -

:< hm.. The player object does indeed skip a pixel or two every few steps, but I can have the camera follow an object that always moves 1 pixel in a direction and it still ends up shaking the object when scrolling..even worse actually. Also I added a dragging camera to a few CPE examples I found and yeah, still shakes the player :\ This leads me to believe the problem still lies in the camera but eh, I dunno. Thanks for the help so far and uhh...who's Adam?

Edited by Tokinsom

 
n/a

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  374

VIP MemberCardboard BoxThe Cake is a Lie
3rd December, 2009 at 22:48:34 -

Most likely the reason why it's shaking is because of the rigid pixelated edges on the slopes. So yeah, I'd say Urban is right; it IS the PMO causing this to occur. However, I also believe that the camera has a small portion to do with this, but probably only because of the method that was used. There's nothing wrong with it, but it's not very reliable. Here's an easier way to do it.

•Always
Camera --> Position --> Set X Coordiante --> (In the expression editor) X("Camera")+(X("Player")-X("Camera")*<number>(Try 0.14; that should work about the same.)

Then for the Y coordiante just change the Xs to Ys accordingly. It's a very handy, stable method. Hasn't failed me once! I tried the method on your example: worked great!

Well, I hope this helps any.



 
An old and washed up once-kid
   

Post Reply



 



Advertisement

Worth A Click