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;
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/