We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, Firstly I just want to say that I didn't know where to ask this question since I didn't found the p5.js forum so I'm asking here, I'll understand if that's not the correct place. Anyway I'm trying to do a pong game using p5 and I'd want the paddles to move continuously when the user press the key (i.e UP_ARROW). I searched a bit and it seems to be possible in Processing using keyTyped() (I'm probably wrong) and I just wanted to know if that's possible in p5. If there is no equivalent, could someone give me an advice on how could I do this?
Thank you in advance,
rebelL1ON.
Answers
@rebelL1ON --
When creating a new post -- or when editing this post now -- you can select the forum category p5.js or p5js--Programming Questions
Those categories are also in the left hand toolbar or dropdown for browsing:
Done :) thanks
For a recent discussion in Processing(Java) of controlling a pong paddle using keyboard input, see:
Have you tried creating an adaptation using from Processing to p5.js before, using the Processing Transition guidelines?
Not what I was looking for :'(
Not sure what else to say without more detail from you. :-??
Did you try saving keyPressed to variables as in that example? What specifically didn't work? Where is your example code?
My code is very messy so yeah good luck trying to read it : tried this https://pastebin.com/wizWbKyU then this https://pastebin.com/kpwYH18n (just added booleans and a function to test where do I move the paddles). The thing I want to do is simply move the paddle when the user press the button (and continue if he holds it) and stop moving when he releases it. Thanks and sorry for the inconvenience. :/
https://p5js.org/reference/#/p5/keyIsDown
https://forum.Processing.org/two/discussions/tagged?Tag=keyisdown()
Thanks man appreciate it! That's exactly what I was looking for have a great day :-*