Path: csiph.com!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Game loop losing fast key presses Date: Sat, 16 Nov 2019 21:21:23 +0000 Organization: A noiseless patient Spider Lines: 19 Message-ID: <87pnhrikks.fsf@bsb.me.uk> References: <8675e9ad-cdfa-4490-9236-c733637de017@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="be2541e1a9b03a313fb1efc4d4a352c5"; logging-data="9925"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NNLjswa8US9r+RWGrUwwlLW93mgjoFXM=" Cancel-Lock: sha1:d10J9FbpEQ8oqpNx2YYlL1RXOCQ= sha1:2RLMwiocx6RLlA1YkohRoZ6w0u0= X-BSB-Auth: 1.8ae7aa3ea5987b714b87.20191116212123GMT.87pnhrikks.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:37801 luserdroog writes: > That's interesting. I think I can make that work. So the fact of the > keypress propagates through a few layers until the inner game loop can > handle it. > > If I make it an integer then the keydown can increment it and the game > sets it to zero. That way the game can respond to multiple taps when it > gets around to it. Surely you have more than one key that matters? If so, you can't just count the presses because the order will most likely matter. You need a small queue of key actions that gets processed when the app can get round to it. (Jumping in here, so I may have missed the point.) -- Ben.