17 minutes
Bomber Helicopter
The download writes the scene only, not src/main.ts. If you start here, add lesson 2.4's T key back to src/main.ts, so you can call the weapons truck:
Rammers, shovers and gunners all come at you along the road. Everything that can hurt you is down at road level, and nothing comes from above.
This lesson adds a helicopter. It flies ahead of you and drops bombs, and it aims each one at the spot where you are going to be. You get two missiles to bring it down.
Where it will be
A bomb does not land the moment it is dropped. It falls for a while, and your car keeps driving the whole time. So the bomber has to aim at where the car will be when the fall ends, not where it is now. Aiming ahead of a moving target like this is called leading it.
First, the fall. Something dropped from height h, with gravity g, falls for:
The bomber flies 15 m up, and a bomb starts 1.2 m below its body. That is a 13.8 m drop. The bomber works with a gravity of 16 m/s², so a falling bomb gains 16 m/s of speed every second:
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.