www.delorie.com/archives/browse.cgi | search |
From: | arganoid AT fatal-design DOT com (Andrew R. Gillett) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Compensate speed in a game.... |
Date: | Tue, 3 Nov 1998 13:36:24 -0000 |
Organization: | Customer of Planet Online |
Lines: | 20 |
Message-ID: | <MPG.10a86aa2860116ff9897e2@news.freeserve.net> |
References: | <wd3%1.6138$8W4 DOT 7661765 AT nntpserver DOT swip DOT net> |
NNTP-Posting-Host: | modem-34.bromine.dialup.pol.co.uk |
X-Trace: | newsreader1.core.theplanet.net 910100207 2879 62.136.17.34 (3 Nov 1998 13:36:47 GMT) |
NNTP-Posting-Date: | 3 Nov 1998 13:36:47 GMT |
X-Newsreader: | MicroPlanet Gravity v2.10 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
In comp.os.msdos.djgpp, article <wd3%1.6138$8W4 DOT 7661765 AT nntpserver DOT swip DOT net>, Sunnvius (keso- 98 AT swipnet DOT se) wrote: > I´m able to find out the fps, but what should I do to compensate > the speed if a person is runnin' with a very fast (or slow) computer? You have to make an interrupt which increases a variable every 60th of a second (or whatever the monitor frequency is). Then you have two lots of code - the code that does movement processing, and the code that draws the graphics. Set your timer variable to zero and start the interrupt. The movement code should run and reduce the timer value by one. This should loop until the timer value is zero. Only then should you draw the graphics. Once you've drawn the graphics, the interrupt may have happened several times, so the aforementioned loop should run through the movement code until it has 'caught up'. -- Andrew Gillett http://argnet.fatal-design.com/ ICQ: 12142937
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |