Update #5 (Week 6)

Last week I struggled with finding and changing aspects of my code due to the way I organized my files. I had the entire game in one long file which made it difficult to work with. I decided to go through my code and separate it into various organized files that can be more easily edited and added on to.

For example, I had a file named Main.cs in which I had an Initialize function, LoadContent function, Update function, and Draw function. Everything in my game was divided up between these categories which made the file very long. Whenever I needed to change something in the code, even as easy as changing the color or size of something, was extremely difficult to do because I couldn’t find it. I realized I was spending more time looking for something within the code than I was actually writing code.

I knew that I would have to separate and reorganize my code so that it would be easier to access, read, and edit. I made a file for Globals that I would have in multiple different files, and various files for the main character, NPCs, etc. By having these all in separate files, it allowed me to use smaller amounts of code in my Main file so that it was more readable and easier to edit.

Going through this taught me the importance of organizing your code in an easy-to-read manner. Although it took a while to organize all of my previous code properly, I am glad that I did it fairly early on in the semester. Going forward, I will continue to use my new organization methods to better keep track of my code, and make it more readable and easier to edit.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php