What a coincidence, I just finished a timer based movement system that handles pausing. Check this out, press up to pause and down to unpause. The timer based movement system is a two-stage pipeline and if you don't call it ever loop (such as when paused) everything will move really fast for one frame to catch up, thinking the framerate is extreamly slow. That's why you need to call Tbm_update() when unpausing to clear out the pipeline for the next frame.
REM Project: [Removed, it's a secret]
REM Created: 5/6/2007 12:29:09 PM
REM
REM ***** Main Source File *****
REM
sync on
Tbm_init(60)
make object cube 1, 1
do
Tbm_update()
turn object right 1, 1*Tbm.factor
if upkey()
do
center text screen width()/2, screen height()/2, "PAUSED"
if downkey() then exit
sync
loop
Tbm_update()
endif
sync
loop
REM *** Include File: Tbm.dba ***
REM Created: 5/6/2007 12:29:35 PM
REM
REM Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectssecret.dbpro
REM
`this include file encapsulates timer based movement
`Public
`Tbm_init()
`Tbm_update()
`Tbm.realfps R
`Tbm.factor R
type Tbm
targetfps as float `this is the target fps of the system, if it is not running at this all movment values will be corrected
realfps as float `true fps the system is running at, more accurate than screen fps()
boot as dword `value of timer() when the system starts
factor as float `this is what all movment values need to be multiplied by to achive timer based movement
lastcheck as dword `value of timer() the last time the system was updated
endtype
function Tbm_init(fps as float)
global Tbm as Tbm
Tbm.boot = timer()
Tbm.lastcheck = Tbm.boot
Tbm.targetfps = fps
endfunction
function Tbm_update()
local now as dword
local took as dword
local factor as float
now = timer()
took = now - Tbm.lastcheck
Tbm.lastcheck = now
Tbm.realfps = 1000.0/took
Tbm.factor = Tbm.targetfps/Tbm.realfps
endfunction
"Once there was a polygon mesh who was very sad because he was only Gouraud shaded."