Skip to content

Instantly share code, notes, and snippets.

@willyandan
Created February 1, 2019 00:24
Show Gist options
  • Save willyandan/f9e16bbef2255f5f761c380ffb492c2d to your computer and use it in GitHub Desktop.
Save willyandan/f9e16bbef2255f5f761c380ffb492c2d to your computer and use it in GitHub Desktop.
pong.js - lógica para mover barras dentro do loop
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