Posted: 10th Jun 2007 20:08
Some of you may know I'm making a game called speedball (just put speedball in the search box), well in this game there are going to be some obstacles that appear and disappear every second. Meaning that you need timing to get past them.

The problem is that these obstacles are currently working inefficently. Occasionally they don't reappear or disappear at the correct time and sometimes only a few obstacles reappear.

I was wondering if it was anything to do with the below code that controls the appearing/disappearing. Can anyone help

+ Code Snippet
for a=3 to 600
         if object exist(a)=1
            if active(a)=8 and (timer()-tii3)/1000>0 and object visible(a)=1 then hide object a : sc_setupobject a,0,0
            if active(a)=10 and (timer()-tii3)/1000>0 and object visible(a)=1 then hide object a : sc_setupobject a,0,0
            if active(a)=8 and (timer()-tii3)/1000>1 and object visible(a)=0 then show object a : sc_setupobject a,1,0
            if active(a)=10 and (timer()-tii3)/1000>1 and object visible(a)=0 then show object a : sc_setupobject a,1,0
         endif
         if a=600 and (timer()-tii3)/1000>1 then tii3=timer()
next a
Posted: 11th Jun 2007 1:16
It's possibly to do with the fact that you are reading the timer value many times within the loop - slowing the routine down.

Although some of the code is missing, (what exactly is sc_setupobject a,1,0?), it looks like the timer value being used is changing within the loop itself - before the loop has completed.

Try getting the timer value before dropping into the loop and using 10ths of a second instead of seconds maybe?

TDK_Man