"Multiplexing" is the word you are looking for. It's good for stats, scores etc.
The basics are as follows:
1. Decide on a suitable number of cycles. This may depend on the number of outputs. For example a display with score, speed, energy and ammo may be split into 4 cycles.
2. Create a counter that counts up every loop, and resets to 1 when it reaches the maximum:
inc multiplex
if multiplex > maxcycles then multiplex = 1
2. Create a simple case statement:
select multiplex
case 1
updateScore()
endcase
case 2
updateSpeed()
endcase
case 3
updateEnergy()
endcase
case 4
updateAmmo()
endcase
endselect
Now, each section only gets updated every 4 cycles. This cuts the stats update code to 25% per cycle, but you would still be updating, for example, 10 times a second at 40 FPS.
BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply