## TOO MANY DISTRACTIONS

Monday, April 29th, 2013 7:56 pm

I just finished my entry for the Jam. It’s called TOO MANY DISTRACTIONS and is about reducing distractions while getting your work done. I hope you like it, here’s the entry link:

http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=20498

WAY TOO MANY

Distractions are happening

The End

## Stop distracting me, LD blog…

Sunday, April 28th, 2013 6:56 am

… I NEED TO WORK, DAMMIT!!!

## Re: Distractions Deluxe

Posted by
Saturday, April 19th, 2008 1:14 pm

My solution:

So the problem is to figure out the direction a player (moving in 3-d) has to shoot to hit an enemy (also moving in 3-d) given their positions, velocities, and the speed of the bullet.

The approach I used was to solve the equation

time it takes the enemy to reach a position = time it takes the bullet to reach the position

for the time.

First, redefine the vectors so that they are all relative to the player. This
leaves you with only bullet speed, enemy velocity, and enemy position. The
points in question are the points along the enemy’s trajectory, so express the
above equation in terms of t:

This can be solved with the quadratic equation:

Note that there may be zero, one, or two solutions. Negative solutions reflect hits in the past. If there are no positive solutions it is not possible for the player to hit the enemy.

Once you have t, it is simple to calculate the position.

Edit: forgot the exponent on the bottom of the final answer.

[cache: storing page]