forums

TNT Basic Forums > Programming Q&A
Game clock
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-29-2003 01:01

Posted by:
rockmusicdragoon

Find more posts by rockmusicdragoon

Is there a way to run a clock based on frame per second passed, and not by milliseconds the program has been active? For example, I would like to base all of the cycles of my battle engine in my RPG by going through the system once per FPS, adding an amount to a meter, cycling again, ad infinitum. Is there a really easy routine to write that can do this or a TNT BASIC command that exists that does it?

Thanks

Jason

10-29-2003 07:18

Posted by:
Miles

Location:
Australia

Click Here to Email Miles   Find more posts by Miles

So you're trying to work out Frames Per Second? couldn't you just...

int prevtime
float fps

... at the start, and then whenever you Draw Frame, you could call the procedure:

Procedure UpdateFPS()
int mil_per_frm=Timer-prevtime
fps=1/(mill_per_frm/1000)
prevtime=Timer
End Proc

And fps would always contain the number of frames per second.

10-29-2003 07:21

Posted by:
Miles

Location:
Australia

Click Here to Email Miles   Find more posts by Miles

Is that what you are trying to do? I don't really know what you mean.

"For example, I would like to base all of the cycles of my battle engine in my RPG by going through the system once per FPS"

How can you base the cycles in your battle system by going through the system once per frame per second? :S

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.