Have you ever wondered what the speed means in the program we all love? You think that if you did, you’d be king of the world, right. Well, if you’re reading this then make sure you’re prepared to fight for the throne.

Finding out how it works is simple. Create an active and three counters. Give the active ball movement. Set the initial direction to 0 (straight right) and the initial speed to whatever you want (speed>0). Capture the active’s x coordinate at the start of frame. Create an always event where you add 1 to another counter. When that counter equals 50, capture the active’s x coordinate.

Now, in your calculator, subtract the initial x coordinate from the x coordinate at end. Divide by 50. Divide by your speed. You should get an answer that is approx. 0.122. This is the pixel increase per speed per loop.

Because that is too simple for an article, I will give a complex example of how you can use it. This will deal with how to make one projectile intercept another.

To begin, you need an already existing projectile and an object to shoot a projectile to intercept it. You must know how fast you’ll shoot the interceptor.

To begin the calculations, take the distance between the projectile and the launcher of the interceptor. Take the x of one and subtract it by the x of the other. Do the same for y. Square them both with the power object and take the square root of their sum.

Create a “blip” (single pixel dummy object) at (0, 0) of the projectile. Using the Direction Calculator, get an x from the direction and speed of the projectile. Because the Direction Calculator isn’t accurate here, multiply it by our magic number (0.122) before adding it to the x of the blip. Repeat for y. Find the distance of the blip.

Subtract the distance of the projectile from that of the blip. This is your “rate of distancing” – how fast the distance between the two increases (this may be a negative number). Multiply 0.122 by the speed that the interceptor will go. Subtract the rate of distancing. Divide the distance by this result. This is the number of frames that it will take for the interceptor to hit the projectile.

Do something like we did with the blip, only this time multiply the x and y to add to the blip by the number of frames. Now, just aim the launcher of the interceptor at the new blip and fire. The interceptor will hit the projectile.

Now, though you may not be king of the world, you now know what “speed” means in MMF and can use it to create complex calculations in your games.

Edit: This can be found in example form at http://www.clickteam.com/mbfiles2/231513-Projectile%20Interception.cca