jitter problem

56 views
Skip to first unread message

CherryAnt

unread,
Mar 16, 2015, 12:57:49 PM3/16/15
to haxef...@googlegroups.com
Hi,
Can anyone test this example:

with mouse left button create a character, with mouse right button kill character
can anyone help me how solve the jitter effect, it makes a optical illusion that seems that some character go back and fordward

I use FlxTypedGroup for the sprites but have the same issue with FlxGroup

Thanks a lot

Valerio Santinelli

unread,
Mar 17, 2015, 7:05:58 AM3/17/15
to haxef...@googlegroups.com
That looks like a rounding problem. What's the code that you use to move the sprites?

CherryAnt

unread,
Mar 17, 2015, 7:25:11 AM3/17/15
to haxef...@googlegroups.com
I have the mouse events on the state update:
override public function update():Void
{
super.update();

if (FlxG.mouse.justReleased){
makeClient(0,100);
}

if (FlxG.mouse.justReleasedRight){
killClient();
}
}

then when left button clicked it calls to makeClient in state class:
public function makeClient(PositionX:Float, PositionY:Float):Void
{
var client:Client = cast(_clients.getFirstAvailable(Client), Client);

//if there is any !exists revive
if(client != null){
cast(client, Client).reset(PositionX, PositionY);
}
}

and in client class the reset and kiil function is:
//Reset function, set defaults values
override public function reset(X:Float, Y:Float):Void
{
alpha = 0.0;
acceleration.x = acceleration.y = 0;

super.reset(X, Y);

//tween to alpha 1.0
FlxTween.tween(this, { alpha:1.0 }, .66, {ease:FlxEase.circOut, complete:function(tween:FlxTween):Void{
velocity.x = 30;
}} );
}

override public function kill():Void
{
if (!alive) return;

alive = false;

FlxTween.tween(this, { alpha:0 }, .66, {ease:FlxEase.circOut, complete:function finishKill(tween:FlxTween):Void{
exists = false;
} } );
}

Thanks for help me!!!

Seanw265

unread,
Mar 17, 2015, 1:17:16 PM3/17/15
to haxef...@googlegroups.com
Try setting FlxG.fixedTimestep = false
I've found that useful!

CherryAnt

unread,
Mar 17, 2015, 1:38:39 PM3/17/15
to haxef...@googlegroups.com
I got in Main.hx:
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
FlxG.fixedTimestep = false;
FlxG.camera.antialiasing = true;

But if i comment any one of that two settings the results are the same.
Thanks
Reply all
Reply to author
Forward
0 new messages