pong game how to get puck to hit off paddle p5js code example
Example: vertical line for pong javascript
// define initial player score
var playerLeft = playerRight = 0
// create text for the score, set font properties
var scoreLeft = draw.text(playerLeft+'').font({
size: 32,
family: 'Menlo, sans-serif',
anchor: 'end',
fill: '#fff'
}).move(width/2-10, 10)
// cloning rocks!
var scoreRight = scoreLeft.clone()
.text(playerRight+'')
.font('anchor', 'start')
.x(width/2+10)