Simultaneous keys press at the same time?

Hi, I am actually pretty new to the concept of programming so forgive me if I sound kinda dumb.

I am trying to make a game using p5 and the p5 dom where there is 6 image randomiser(think slot machine) and each image is associated with a key each. The image will only stop moving if the keys are held down. Right now I am unable to hold more than 2 keys at the same time, if I hold 3, the 3rd key wont stop the randomiser and sometimes even force release my other keys.

Is this a JS limitation or I am just missing something?

Can I ask you to provide your code? (Formatted)

is there anywhere i can upload the code? JSfiddle does not seems to have the p5.dom.js inside

If possible, isolate the bug to a smaller block of code, and then just post it straight onto here as text. (And then formatted with the </> button

I have no idea where the bug is… and it is a website so it consist of html, css, and js(p5) files.

It will take time, but debugging code is a very important skill to learn as a programmer - in fact, the general rule is that your code should take longer to debug than it took to write.

It sounds like your bug(s) are hiding - to find them, you’re going to have to start looking. Comment code out piece by piece. Insert console.log() statements. Bug hunting is not always fun, but it’s definitely a necessary skill to learn.

Once you have found (or suspect you have found) the trouble code, we can start honing in here on the forum.

1 Like