-
Senior Member
[help/disc] frame rate/key press/loop
Here's the thing, when I built the prototype for my game I knew that most of the calcs that would eventually be needed for the game would slow it down, but I figured that 12fps would be enough to see what was going on.
The prototype was built, frame rate was fine. The the more processor heavy calcs were added, and surprisingly it didn't slow the game down. So much so, that 12fps was still fine. Except that sometimes it missed a keypress.
So, I up the frame rate, no keypresses were missed, but the game is now way too fast.
So I introduce a variable, which means that it only moves every other frame, this seemed to also reintroduce the problem of not necessarily detecting every key press.
So, then, I change the key input to push the direction variable to an array - this seems to work ok, but I wondered if anyone else had come across a similar problem/better solution?
-
curiouser and curiouser
just as a bit of morale support, I've got the same problem. I haven't got a solution yet, I was planning on playing around with key listeners and hoping they would react faster, (I'm just using Key.isDown at the moment) but it's still way down on my 'to do' list...
-
struggling for a custom avatar
If I remember stuff correctly there's a thing called set Interval which can be used instead of relying on the frame rate. It's a bit more complicated, but you can adjust the check to occur at milliseconds instead of when entering a frame.
www.promqueen.se
www.informationoverdose.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|