New answers tagged

2

I don't think the WebSockets protocol has the speed that you'd be looking for in a real-time game. "The technique is effective, but is not well suited for applications that have sub-500 millisecond latency or high throughput requirements." Websockets are built on top of TCP, which ensures that every packet of information is received by the client. Do you ...


1

You can make an invisible copy of your ball which you update for as long as it didn't reach the paddle. Here's an example: Suppose you have a ball class which looks something like this: function Ball(x, y, size) { this.x = x; this.y = y; this.size = size; this.vx = 0; this.vy = 0; } Ball.prototype.update = function () { // Move the ...


1

Simple solution: Have the paddle always move towards the current horizontal position of the ball. When the x-coordinate of the ball is larger than the x-coordinate of the center of the paddle, move it right, otherwise move it left. Better solution: Extrapolate where the ball will reach the finish-line and have the paddle move towards that point. In both ...


0

I'm not sure what you want to achieve. You could avoid pausing the game when it is out of focus: game.stage.disableVisibilityChange = true; or given the latest position of the bullets just update them when the game is unpaused. In this case is possible that the bullets have hit something/someone and no longer exists, but the general idea is to update the ...


1

Just add this to the bottom of the HTML page that Unity generates for you BEFORE the Module declaration and UnityLoader.js is loaded (I wouldn't hack the UnityLoader.js file because it'll get overwritten every time you do a build). <script> if (!window.WebGLRenderingContext) { window.location = "http://whatever.com"; } </script> ...



Top 50 recent answers are included