I need help plz thanks if you do im a beginner sorry

hi I don’t know why my keyPressed isn’t working, I copied and pasted references and they don’t work either, i’m not sure if it’s a me problem.

https://editor.p5js.org/chuud/sketches/FtKfFDUL5

sorry if i used wrong format i’m not sure how to use it

keyPressed() is a separate function and should not be inside the draw() function. Move it to below where you ended the draw() function and it should work.

It’s often easier to spot mistakes if you indent your code properly. I don’t use p5.js but saw the below when I clicked Edit

It will not fix the errors but as I said they would be easier to spot once you know what to look for. E.g. after Tidy code the keyword Function should be at the beginning of a line.