| delorie.com/archives/browse.cgi | search |
| From: | quake AT megsinet DOT net (exph) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Allegro-accelerating |
| Message-ID: | <382e81ce.546447@news> |
| References: | <80k5uc$40u3 AT imsp212 DOT netvigator DOT com> <80k6pn$eni$1 AT news03 DOT btx DOT dtag DOT de> <80k92i$88q$1 AT baker DOT cc DOT tut DOT fi> |
| X-Newsreader: | Forte Free Agent 1.11/32.235 |
| Lines: | 41 |
| Date: | Sun, 14 Nov 1999 07:33:56 GMT |
| NNTP-Posting-Host: | 24.10.211.8 |
| X-Complaints-To: | abuse AT home DOT net |
| X-Trace: | news.rdc1.il.home.com 942564836 24.10.211.8 (Sat, 13 Nov 1999 23:33:56 PST) |
| NNTP-Posting-Date: | Sat, 13 Nov 1999 23:33:56 PST |
| Organization: | @Home Network |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
On 13 Nov 1999 18:01:54 GMT, Forsberg Sakari <zacu AT cc DOT tut DOT fi> wrote:
>Raul Carolus <carolura AT luther DOT edu> wrote:
>> be sure to call install_keyboard() before using:
>
>> while(keypressed())
>> {
>> variable++;
>> }
>
>I think if you're programming a real-time game, then you
>should use
>
>if ( keypressed() )
> variable++;
>
>because otherwise your game stops when you are pressing a key
>
>** Sakari Forsberg zacu AT cc DOT tut DOT fi **
>** Information: finger zacu AT assari DOT cc DOT tut DOT fi **
Simple enough to decrease the variable when a key is not being
pressed. Taking Sakari's example...
if ( keypressed() )
variable++;
else
variable--;
or if you need to accelrate faster..
int acc=5;
if ( keypressed() )
variable+=acc;
else
variable-=acc;
Are you picking up what I'm putting down?
Hope this helps.
-exph-
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |