A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [help/disc] frame rate/key press/loop

  1. #1
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508

    [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?

  2. #2
    curiouser and curiouser LittleRed's Avatar
    Join Date
    Mar 2004
    Location
    Nottingham
    Posts
    335
    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...

  3. #3
    struggling for a custom avatar
    Join Date
    Apr 2004
    Posts
    45
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center