Author Topic: Problem with FlxCamera when updating x/y manually  (Read 803 times)

Liaf

  • Member
  • **
  • Posts: 19
  • Karma: +0/-0
  • yay!
    • View Profile
I'm currently working on a project where I have an object (a tree) that updates the positions of it's childs (the leafs) manually.
However when using the follow() function of FlxCamera to follow the tree, the leafs start to jitter/shake and are lagging behind when scrolling with the camera. There is no shaking without camera scrolling, as long as I don't follow an object, everything's fine.

This is the update of my tree:

Code: [Select]
override public function update():void
{
super.update();

leaf1.x = x + 20;
leaf1.y = y;

leaf2.x = x;
leaf2.y = y;
}

This is how I call follow() :
Code: [Select]
var c:FlxCamera = new FlxCamera(0, 0, 640, 480, 1);
c.setBounds(0, 0, 640, 48000, false);
c.follow(tree, FlxCamera.STYLE_LOCKON);

FlxG.addCamera(c);

I tried different Camera Styles, but it didn't help.
I'm out of ideas and I hope someone can help me.
« Last Edit: Mon, May 14, 2012 by Liaf »