2
I have these two functions, however, my problem is in moveRacketE(), I’m doing a ping pong, only I wanted to make for two people to play, and not I play against the computer, as I could add the W key to go up, and the S key to go down in moveRacketE function()?
function moveRacket() {
if(keyIsDown(UP_ARROW)) {
yRacket -= 10;
}
if(keyIsDown(DOWN_ARROW)) {
yRacket += 10;
}
}
function moveRacketE() {
if(keyIsDown(event.key == 87)) {
yRacket -= 10;
}
if(keyIsDown(event.key == 83)) {
yRacket += 10;
}
Try to use
if(keyIsDown(87))
andif(keyIsDown(83))
– Miyukii
I used, however, it is moving my racket, and I would like to move the enemy racket
– Vagner Wentz
I managed to tidy up, I had to change the yRacket to yRacketE, which was the variable I created, thank you very much.
– Vagner Wentz