Hot answers tagged

3

Use the normals of your surfaces to calculate this. Essentially, you're taking your existing edge, and growing it. Then, in some cases, optimizing it to cut out loops or tight corners. For each corner, you get the averaged normal for the two surfaces that make up that corner. For interior corners, since the average would be pointing towards each other, you'...


2

Raycasts and steering You'll find the path as you go, casting rays and checking for different cases. Pink - Your entity Red - Offset ray. Cast perpendicular to the forward of your entity. Maintains a specific distance from the wall and used to ensure the wall is still there. Blue - Look ahead ray. Looks ahead for the wall and is responsible for the ...


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 ...


1

Another strategical rule of Tetris you didn't mention is that it is crucial to avoid closing up holes. || Bad move! \/ ## ## ### ##### # ### ###### # ### ####### # <-Creates a closed up hole on this row. ########### # Place it somewhere on top instead! When there is no way around it, it's better to create the hole in a row ...



Only top voted, non community-wiki answers of a minimum length are eligible