Refactor cooldown variables
Use safer comparison operators === and !==

In JavaScript, == and != do type coercion, giving more possibility for error.
Remove unnecessary code about obstacles

There is no need to set the x value of the obstacle every frame; it keeps the x it was initialized with. And setX is probably already taken by a function; the function should not be overwritten with a number. `setX` is probably used by calling it with `()`, not assigning to it with `=`.

There is no need for a “struck” variable for the pole, which insta-kills, and the policeman, which doesn’t hurt you when you strike it.