Skip to content

Instantly share code, notes, and snippets.

@willyandan
Created January 31, 2019 22:15
Show Gist options
  • Save willyandan/4cec76169958bfce25cdaa1413c9aa4b to your computer and use it in GitHub Desktop.
Save willyandan/4cec76169958bfce25cdaa1413c9aa4b to your computer and use it in GitHub Desktop.
pong.js - initBall()
let ball_y_orientation, ball_x_orientation, ball_x, ball_y
function initBall(){
console.log(`${p1_points} VS ${p2_points}`)
ball_y_orientation = Math.pow(2, Math.floor( Math.random() * 2 )+1) - 3
ball_x_orientation = Math.pow(2, Math.floor( Math.random() * 2 )+1) - 3
ball_x = w / 2 -10
ball_y = h / 2 -10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment