A vector is an arrow: which way, and how far. Your keys build one arrow, dir. Switch
normalize off and on, and watch what happens to the speed when you move diagonally.
The game arrow keys / WASD / buttons
dir (after the switch)
(0, 0)
moving at
0 px/s
The code speed = 60 px/s
The arrow drag on it to try any vector
v = (0, 0)
length(v) = 0
normalize(v) = (0, 0)
Hold some keys, or drag on the square. The dotted circle is length 1.
Things to try
Switch normalize off. Hold right, then right + down. Compare "moving at".
Switch it back on. Diagonal is 60 now, the same as straight. Bug fixed!
Drag on the arrow square to make (1.2, 1.6). What's its length? (A famous 3-4-5 triangle, made smaller.)
Drag an arrow of any length: normalize always lands on the dotted circle.