Right so I'm a bit new to JS and I wanted to know how to put a roof or height limit within this small canvas game. It's practically W3's code but the teacher told us to just model after it. I wanted to fix the annoying issue of just jumping over the map to avoid obstacles.

I don't really know what to try since the height is set by canvas. I tried to make a new function based of hitBottom() which failed.

Just wanted to put the roof or height limit. Here's the original source: [Here](https://www.w3schools.com/graphics/tryit.asp?filename=trygame_default_gravity). Everything is literally the same except colors.