()
| 242 | |
| 243 | // render function draws everything on to canvas |
| 244 | function render() { |
| 245 | // set a style |
| 246 | ctx.fillStyle = "#000"; /* whatever comes below this acquires black color (#000). */ |
| 247 | // draws the black board |
| 248 | ctx.fillRect(0, 0, canvas.width, canvas.height); |
| 249 | |
| 250 | // draw net |
| 251 | drawNet(); |
| 252 | // draw user score |
| 253 | drawScore(canvas.width / 4, canvas.height / 6, user.score); |
| 254 | // draw ai score |
| 255 | drawScore(3 * canvas.width / 4, canvas.height / 6, ai.score); |
| 256 | // draw user paddle |
| 257 | drawPaddle(user.x, user.y, user.width, user.height, user.color); |
| 258 | // draw ai paddle |
| 259 | drawPaddle(ai.x, ai.y, ai.width, ai.height, ai.color); |
| 260 | // draw ball |
| 261 | drawBall(ball.x, ball.y, ball.radius, ball.color); |
| 262 | } |
| 263 | |
| 264 | // gameLoop |
| 265 | function gameLoop() { |
no test coverage detected