Sprite movement not very smooth

Hi I’m trying to write a simple game in the style of “traffic rush” where cars approach a crossroads from all directions.

But the movement of the “cars” is a bit jumpy.

I’m animating the movement of the “cars” (sprites with an image in as a child) using this code

var pos = this.getPosition();
pos.x +=this.*sx * dt;
pos.y +=this.*sy * dt;
this.setPosition(pos.x,pos.y);

The cars are all PNG and approx 64 pixels square

The problem occurs on Firefox and Safari on OSX (It may occur on PC but I"ve not tested it yet)
I’m running at 60fps, but reducing this to 25 doesn’t seem to remove these judders.

Does anyone know why calls to update seem to occasionally not happen for 50 to 100 milliseconds?

PS. I’ve uploaded a version with placeholder graphics to http://www.rogerclark.net/demos/html_traffic_control/

Thanks for feedback. I have tried your game. Maybe it caused by no enough smooth schedule.

We are separating the schedule from main loop. I will check the bug again when it is finished.

@Shun Lin

Thankyou

Its not so important for the operation of the game, so I will continue, but it would be better if the animation was smooth :wink:

Cheers

Roger