realbasic-games
[Top] [All Lists]

Re: Cross Platform method for detecting key ups?

To: REALbasic Games <REALbasic-Games at lists dot realsoftware dot com>
Subject: Re: Cross Platform method for detecting key ups?
From: Daniel Lurie <dl1021 at optonline dot net>
Date: Sun, 19 Oct 2003 21:20:10 -0400

On Sunday, Oct 19, 2003, at 16:58 America/New_York, Joseph J. Strout wrote:

At 4:41 PM -0400 10/19/03, Daniel Lurie wrote:

I had a game where the action ran at 8 fps. It was driven by a timer going off every 8th of a second.

Unfortunately, this meant the keyboard was only being polled 8x/second which was too sluggish. So, now the keyboard polls as fast as possible, but the game logic is only updated at 8fps. I have a string property of the window that keeps track of what keys were hit last.

Seems like a reasonable approach.

Every time the game logic goes off, it uses those last keypresses to move the character. Then it empties the string. For some reason it occasionally goes 2x in a particular direction. I don't know why this should be.

That should be impossible given the way you've described how it works. I would suggest looking into this more deeply. Since using the debugger here is likely to screw things up (due to timing issues), I'd suggest logging instead -- print out exactly what your key string is on each frame, and what your code is doing about it.

How are you detecting the keys? Using the Keyboard class, or the KeyDown event?

HTH,
- Joe

The timer calls keyboard.asynckeydown()

I am perplexed as all hell.

============
Daniel R. Lurie
============


- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>