Have multiway keep track of the number of keys pressed for each direction#794
Have multiway keep track of the number of keys pressed for each direction#794cwgorman wants to merge 2 commits intocraftyjs:developfrom
Conversation
…tion. So if W and UP_ARROW both correspond to the same direction, pressing both at the same time will have no effect, instead of doubling the speed.
|
Hey @cwgorman You are right, that is not the intended behaviour. That should be fixed! I looked at the code and have some comments: You should avoid creating new variables since that will force the garbace collecter to work and we will want to avoid that. Is type conversion also needed here? (Have not runned the code myself, so can not immediately tell) |
|
@kevinsimper I've made the changes you've requested. Sorry it took so long; I haven't had much time for personal work lately. I am curious about the garbage collection though. Is it actually slower than performing the additional lookups? I assumed the JS engines in today's browsers would be smart enough to optimize that. |
|
I ran into this one over the last weekend. Patch looks good to my unexperienced eye - anyone else still looking at this? |
|
How will this code perform in the following hypothetical case: Maybe we could split the
This would solve the space shooter example, but still isn't precise enough for non-symmetric keys, but I think even this is overkill. |
|
ty cwgorman the proposed changed was integrated alongside other improvements to |
So if W and UP_ARROW both correspond to the same direction, pressing both at the same time will have no effect, instead of doubling the speed. Resolves issue #793.