Author Topic: FlxG.follow kinda jumpy  (Read 1422 times)

BrandonIsABadass

  • Member
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
FlxG.follow kinda jumpy
« on: Thu, Jul 1, 2010 »
Is there any way to make the FlxG.follow follow exactly pixel for pixel instead of the weird smoothing way? 

Here's my code:

Code: [Select]
crossHair = new FlxSprite(100, 100, Crosshair);
this.add(crossHair);
FlxG.follow(crossHair, 1);
FlxG.followAdjust(1, 1);

I have it where the crossHair moves based on where the mouse is. (its not 1:1 movement)

What happens is that there is weird 1 or 2 pixel jump when the mouse isn't moving before it settles.  I've trying tweaking the followAdjust values but it just seems to making it worse.

Perhaps some function to tell the camera to stop all movement?

luciebara

  • Member
  • **
  • Posts: 15
  • Karma: +0/-0
    • View Profile
    • Midnight'mare (My Band ;D)
Re: FlxG.follow kinda jumpy
« Reply #1 on: Thu, Jul 1, 2010 »
I Think there's a class on FlxG called followLead, that perharps eliminate this kinda o leap, but actually i cant help you right now becoz i'm at work, and i am not so in of the follow engine hahaha however, try to insteed of putting a FlxG.follow put:

Code: [Select]
FlxG.followLead(crossHair);
-
I am not a human anymore, I traded my attitude and I traded my spine, placid weak as piss wanna **** in my car?
-

BrandonIsABadass

  • Member
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: FlxG.follow kinda jumpy
« Reply #2 on: Thu, Jul 1, 2010 »
I looked it up - followLead is a point. So, I just set the x and y to random numbers but it just makes the crosshair goes crazy across the screen, lol.  

Setting the x and y to 0 gives it a nice bouncy effect.. not jittery anymore, though.  Playing with the followLerp tightens a little bit more.. might be passable for now.

I wish there was some way to just set the x and y of the camera.. or is there?
« Last Edit: Thu, Jul 1, 2010 by BrandonIsABadass »

Retro-Rob

  • Active Member
  • ***
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Re: FlxG.follow kinda jumpy
« Reply #3 on: Thu, Jul 1, 2010 »
Where are you calling

crossHair = new FlxSprite(100, 100, Crosshair);
this.add(crossHair);
FlxG.follow(crossHair, 1);
FlxG.followAdjust(1, 1);


should be in the create() function of the playstate if it's not.

BrandonIsABadass

  • Member
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: FlxG.follow kinda jumpy
« Reply #4 on: Thu, Jul 1, 2010 »
Yep, thats where I got it.

Quasiperfect

  • Member
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: FlxG.follow kinda jumpy
« Reply #5 on: Thu, Jul 1, 2010 »
Are there any calls to FlxG.follow() in the update function?

Morinar

  • Guest
Re: FlxG.follow kinda jumpy
« Reply #6 on: Fri, Jul 2, 2010 »
Change:

Code: [Select]
FlxG.follow(crossHair, 1);
To:

Code: [Select]
FlxG.follow(crossHair, 0);
I *think* that's what you are looking for. It should keep the follow object directly in the center (or wherever you've adjusted it to).

datorum

  • Active Member
  • ***
  • Posts: 165
  • Karma: +0/-0
    • View Profile
Re: FlxG.follow kinda jumpy
« Reply #7 on: Fri, Jul 2, 2010 »
Change:

Code: [Select]
FlxG.follow(crossHair, 1);
To:

Code: [Select]
FlxG.follow(crossHair, 0);
I *think* that's what you are looking for. It should keep the follow object directly in the center (or wherever you've adjusted it to).
excellent!! works for me :)