15 minutes
Enemy Drivers
Series 1 left you on an endless highway, with traffic, trees you can hit, nightfall and sparks. Every car on it is polite. Civilians keep their lanes, and nothing chases you. Nothing can hurt you either, because your car has no health.
This lesson adds two kinds of enemy, the rammer and the shover, and gives you 100 hit points to lose.
One push and two cars
When two cars touch, the hit pushes both of them by the same amount, in opposite directions. How much a car's speed changes depends on its own mass:
A light car's speed changes a lot, and a heavy car's barely moves. Say a shover van swipes you from the side at 8 m/s. Your speed changes by 2.72 m/s. The van's changes by 1.10. It is the same push, but the van is 2.5 times heavier than you.

A small change in speed is free. Past 4 m/s, it starts to hurt:
Armour, CarCollision's armor field, is a shield. Only 1 − armour of the damage gets through, so your car's 0.15 lets 85% in. ramDamage is how hard the other car hits, and damageTaken scales every hit your car takes.
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.