MCPcopy
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / render

Function render

assets/js/pingpong.js:244–262  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

242
243// render function draws everything on to canvas
244function 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
265function gameLoop() {

Callers 1

gameLoopFunction · 0.70

Calls 4

drawNetFunction · 0.85
drawScoreFunction · 0.70
drawPaddleFunction · 0.70
drawBallFunction · 0.70

Tested by

no test coverage detected