Category : pong

So I’m making a Pong game for a programming exercise. Everything else seems to work, but the collision detection does not work whatsoever as the ball flies through the paddles like a phantom. player.top = player.y; player.right = player.x + player.width; player.bottom = player.y + player.height; player.left = player.x; ball.top = ball.y – ball.radius; ball.right ..

Read more

I have code that connects to an external WebSocket API, which looks like follows: const WebSocket = require(‘ws’) const ws = new WebSocket(‘wss://example.com/’) const connectExternalAPI() => { ws.onopen = () => { ws.send(JSON.stringify(‘example’: ‘message’)) } ws.onerror = (event) => { console.error(event) } ws.onmessage = (event) => { console.log(event.data) } ws.onclose = (event) => { console.error(event) ..

Read more