@ _Pauli_
Sorry, still haven't sent you that distortion function...
I just didn't get around to it. I do have something else up my sleeve though, it's a function that handles timer-based movement. The special thing about it is it will regulate how fast the loop runs without having to multiply every single variable with a delta time. Here it is:
Put this at the top of your code:
rem cometSYNC function
global c_syncrate as float
global c_update as float
global c_ssync as float
global c_offset as float
global c_stime as float
global c_time_elapsed as float
global c_oldtimer as float
global c_cloop as float
global c_lastloopsmissed as float
global c_loopsmissed as float
global c_result as float
global c_skip# as float
global c_incskip# as float
global c_sx# as float
global c_sy# as float
And replace every
sync command you have in your game with this function:
rem comet sync function
function cometSYNC(c_syncrate,c_update)
rem get time elapsed
c_syncrate=c_syncrate/(1000/c_update)
c_ssync=c_syncrate
inc c_syncrate,c_offset
c_stime=timer()
c_time_elapsed=c_stime-c_oldtimer
rem count loops
inc c_cloop
rem check if 1 second passed
if c_time_elapsed>=c_update
rem calculate loops missed
c_lastloopsmissed=c_loopsmissed
c_loopsmissed=((c_syncrate-c_cloop)+c_lastloopsmissed)/2
rem reset values
c_result=c_cloop
c_cloop=1
c_oldtimer=c_stime
rem calculate when to skip next loops
if c_loopsmissed<1
c_skip#=0
c_incskip#=0
else
c_sx#=c_syncrate
c_sy#=c_loopsmissed
c_skip#=c_sx#/c_sy#
c_incskip#=c_skip#
endif
inc c_offset,(c_ssync-c_result)
c_result=c_result*(1000/c_update)
endif
rem sync
if int(c_skip#)=c_cloop then inc c_skip#,c_incskip# else sync
endfunction c_result
I found setting c_update to a value of 500 works the best. Instead of this:
rem start of main loop
do
rem do stuff
rem refresh screen
sync
rem end of main loop
loop
Do this:
rem start of main loop
do
rem do stuff
rem refresh screen
cometSYNC(60,500)
rem end of main loop
loop
I haven't had the chance to play your game yet, but from what the others say I can see that this must be a really fun game
Well done!
TheComet