Studio 7B Bonus

I was just wondering if anyone was able to keep the rocket from leaving the background. For whatever reason, my if statements weren’t working. I tried it a couple of different ways:

  1. I had an integer variable that I declared that updated by 10 every time the rocket was moved. When I used an if statement with the condition that the variable was less than a certain number, the rocket still moved anyways even after it had reached that number. (A console.log confirmed that the variable was updating correctly.

  2. I tried using a conditional ( !== ‘0px’) and that didn’t work either. Rocket just kept going up, even after the condition was met.

Not really sure what I’m doing wrong here, as this seems pretty simple on the surface.