Figure 20-3: Computer graphics coordinates
The getXChange() function therefore returns a positive value if the move-
ment is towards the right and a negative value if moving left. Likewise, the
getYChange() function returns a positive value if moving upward and a nega-
tive value if moving downward.
To know which button was pressed or released, use getButton() . This func-
tion returns one of three predei ned values: LEFT_BUTTON , RIGHT_BUTTON or
In the early days of computers, there were no graphics. “Colossal Cave Adventure”
was the game that started a whole new genre: computer adventure games. More
like an interactive book, these games presented the user with a text represen-
tation and asked the user what to do, again, in text. Colossal Cave Adventure
was so detailed that some people visiting the cave that it was based on actually
recognized their surroundings.
The game recognized simple text commands and, through these actions,
completed the story through several possible paths. You might get something
You are in a small clearing. Butterl ies dance in the sunlight, and there is
bird song above. To the south there is a small stream, to the east you can
see a small house, and to the north there is an apple tree.