Skip to content

Instantly share code, notes, and snippets.

@willyandan
Created January 31, 2019 23:28
Show Gist options
  • Save willyandan/1650cc1cec9aaf7fc4eb03f82fe5b436 to your computer and use it in GitHub Desktop.
Save willyandan/1650cc1cec9aaf7fc4eb03f82fe5b436 to your computer and use it in GitHub Desktop.
pong.js - draw
function draw(){
// fundo
drawRect(0,0,w,h,"#000")
// player 1
drawRect(p1_x, p1_y, p_w, p_h)
// player 2
drawRect(p2_x, p2_y, p_w, p_h)
// barra lateral
drawRect(w/2 -5,0,5,h)
// bola
drawRect(ball_x, ball_y, 10, 10)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment