The process of debugging means figuring out what’s wrong with your code!
We’ve all done this on our own before, but learning how to do it well is one of the key aspects of being a programmer.
A great idea is to isolate the Sprite that isn’t working or figure out what is or isn’t happening, and then trace back to the code that controls that portion of the game!
Main steps of debugging:
- Ask the question- what do I want my program to do?
- Ask another question after that- what is NOT doing what it needs to be doing in order for my game/program to work as it should?
- Go to the code segment for whatever isn’t working!
- Fix what needs to be fixed!
- Ask peers or your teacher for help
- Test your program!
Having a specific GOAL or INTENTION in your game will help you a lot!
Isolate what isn’t working! Maybe a score counter is not going up, maybe a sprite isn’t moving correctly. Figure out WHAT the issue is first!
The reason we isolated the issue in the last step was so that we could do this one- go to the code for the thing that isn’t working!
If it’s a sprite movement issue, go to that sprite and look for any blue movement blocks in the code to try to figure out which one isn’t doing what you would like it to.
You can do this through a lot of methods: trial and error/guess and check is always a good one! Another great option is to look at past projects with similar code.
It’s perfectly okay to turn to others! Once you’ve done everything you can, there is NOTHING wrong with asking others for help!
This step will likely be repeated a LOT throughout the developmental process- press that little green flag and figure out what you need to work on next!
Copyright © 2021 Code 4 Tomorrow. All rights reserved. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact firstname.lastname@example.org for inquiries.