Hello Guys,

I tried implementing the animated Layer concept for creating a moving race track in the 2D racing game which I am trying to design. I am using two images (128X64) each for this. I am trying to create the motion by tile animation of two very similar images to create an illusion.

However the flickering rate is too high in animated layers. Can you tell me if there's a better approach.

My code snippet>

if (switchTile)
{
tiledBackground.setAnimatedTile(animatedIdx, 1);
}
else
{
tiledBackground.setAnimatedTile(animatedIdx,9);
}
switchTile = !switchTile;
layerManager.paint(g,0,0);
flushGraphics();
tiledBackground.setCell(1, 1, animatedIdx);

Thanks
Rajat