Created
February 1, 2019 00:24
-
-
Save willyandan/f9e16bbef2255f5f761c380ffb492c2d to your computer and use it in GitHub Desktop.
pong.js - lógica para mover barras dentro do loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function loop(){ | |
... | |
if(p1_key == 87 && p1_y > 0){ | |
p1_y -= 10 | |
}else if(p1_key == 83 && p1_y + p_h < h){ | |
p1_y += 10 | |
} | |
if(p2_key == 38 && p2_y > 0){ | |
p2_y -= 10 | |
}else if(p2_key == 40 && p2_y + p_h < h){ | |
p2_y += 10 | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment