Hi,
I'm trying to make the background of my game switch smoothly between two backgrounds so that the road looks like it's moving. This is what I've got at the moment:
This is a function I'm using in my world. For some reason, it won't switch between worlds for the same amount of time; "Road 1" flashes, and "Road 2" stays there for longer. Is there any way to make them both remain for the same amount of time?
public void imageSet() { String sRoad1 = "Road 1.png"; String sRoad2 = "Road 2.png"; setBackground(sRoad2); delayImg++; if (delayImg < 10) { return; } delayImg = 0; setBackground(sRoad1); delayImg++; if (delayImg < 10) { return; } delayImg = 0; } /** * Delay code: * https://www.greenfoot.org/topics/57766/0 * By Super_Hippo * * private int delay = 0; * delay++; if (delay < 4) return; delay = 0; */