y did the king have to move that way? it cud hv moved along the diagonal

Yes, he could have moved 3. Kf2 instead of Kg2, but what would be the advantage?Surely not 4. Ke3 after 3. ... Nxd4 - that would just set up another fork. And having the king at f2, leaves him open to Rh2+, followed by Rxb2 after white king moves out of check.