You probably only need to look at obstacle.js
I have a class which draws a square on a canvas and adds collision detection to it.
When I create one instance it wor