Game Development Reference
In-Depth Information
7 - Using the Debugger
stored. Global variables are the variables that are created outside of any functions (that
is, in the global scope). There is also a Local area , which shows you the local scope
variables and their values. The local area will only have variables in it when the program
execution is inside of a function. Since we are still in the global scope, this area is blank.
The Python debugger (and almost all debuggers) only lets you step forward in your
program. Once you have executed an instruction, you cannot step backwards and undo the
instruction.
The Go and Quit Buttons
If you get tired of clicking the step button over and over again, and just want the program
to run normally, click the Go button at the top of the Debug Control window. This will tell
the program to run as if you didn't have the debugger turned on.
If you ever want to terminate the program while it is running, just click the Quit button at
the top of the Debug Control window. The program will immediately exit. This can be
handy if you want to stop the program and start debugging it from the beginning again.
Stepping Into, Over, and Out
Start the Dragon Realm program with the debugger, and keep stepping (by clicking the
Step button in the Debug Control window) until the debugger is at line 38 (the call to
displayIntro() line). When you click Step again, the debugger will jump into this
function call and appear on line 5 (the first line in the def-block of the displayIntro()
function. The kind of stepping we have been doing is called stepping into , because it will
step into function calls.
Search WWH ::




Custom Search