The key to a side-scrolling game is the jumping and landing mechanic. As
with the lunar lander described earlier in this chapter, use a falling property
to track whether the character should respond to gravity or not. Here’s
the code from the checkKeys() method that reads the up arrow and makes
the character jump.