Thus, read the project specifications, create a class hierarchy (UML diagram) and create a list of events that details how you want your program to execute once run. Spending a couple minutes planning now will save you hours in debugging. Every piece of code should be written with deliberate intent - a lack of plan will result in spaghetti code and will be a headache to debug. When programming a game, it’s important have a plan of how you expect your code to be structured. For example, a GameObject class can act as the parent of all the objects drawn to the screen (pacman, ghosts, fruit and walls) They use inheritance to minimize redundant code.They all have a main Game class where the game attributes are stored eg.They all have a main run loop where the game has “ticks” (a measure of time in games) as well as draws to the screen.The code structure of all games have common thematic ideas
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |