Hi, kinetic energy is a scalar quantity that means it does not depend on the path, it depends on only initial and final points. so it does not matter whether an object travels a zig- zig path or a linear path in Physics.
you can use the same formula of kinetic energy = (1/2) * m * (v^2).
and there v = speed of an object (not the velocity).
* I hope you understand above answer. if you have any more doubts, please make a fresh request.