Game Development Reference
In-Depth Information
Figure 7-3: Keep stepping until you reach line 38.
If you click Step a few more times, you will see the output of the
print()
function call
appear in the interactive shell window one at a time. When you step over the last
print()
function call in the
displayIntro()
function, the debugger will jump back to the first
line (line 40) after function call.
Click Step one more time to step into the choosecave function. Keep stepping through
the code until you execute the function call
raw_input()
call. The program will wait
until you type a response into the shell, just like when you run the program normally. If you
try clicking the Step button now, nothing will happen because the program will wait for a
response.
Enter a response by clicking back on the interactive shell window and type which cave
you want to enter. You have to click on the bottom line in the shell before typing. If you are
typing but nothing appears on the screen (and the blinking cursor is not below the
Which
cave will you go into? (1 or 2)
text), then you have not clicked on the last
line of the shell window.
Once you press the Enter key to enter your response, the debugger will continue to step
lines of code again. Instead of clicking Step, try clicking the
Out
button on the Debug
Control window. This is called
stepping out
, because it will cause the debugger to step
over as many lines as it needs to until it jumps out of the function that it was in. For
example, if you were inside the
displayIntro()
function on line 6, clicking Out would