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?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 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: * By Super_Hippo * * private int delay = 0; * delay++; if (delay < 4) return; delay = 0; */ |