In this video we take the code from my “How to Program a Game (in Python)” tutorial and refactor it to be of a more professional quality. To do this we abstract out similar parts of the code into their own classes & files. Once the new code is written, we go through some examples of how we can extend its functionality in fun ways. We make a couple more difficult levels of the game which is made very easy by the new code architecture. The final product is a lot more similar to code you would write as a full time software developer at a company like Google, Facebook, etc…
As always I left a video timeline in the comments! If you enjoy this video please consider giving it a like & subscribe for future content :). If you have any questions let me know in the comments!
Follow the homies!
/ shaneboyer_
/ _neos
Source code for Game (original & refactored):
https://github.com/KeithGalli/Basic-P...
Link to original How to Program a Game (in Python) Tutorial:
• How to Program a Game! (in Python)
Link to video on Classes & Object Oriented Programming:
• Everything you need to know about Cla...
Additional information on Getters & Setters:
• Python OOP Tutorial 6: Property Decor...
Some great resources if you want to write better/cleaner code! (affiliate links)
https://www.python.org/dev/peps/pep-0...
https://amzn.to/2U90SWk
Join the Python Army to get access to perks!
YouTube - / @keithgalli
Patreon - / keithgalli
---------------------
Follow me on social media!
Instagram | / keithgalli
Twitter | / keithgalli
---------------------
Video Timeline! (& some additional resources)
0:00 Video overview & code setup
3:04 Creating a Player Class
10:43 Creating subclasses for our Enemy & HumanPlayer
11:26 Creating a Color class
14:35 Creating a screen class or all our game visuals
27:00 Creating a game class for all our game logic
32:54 Information on Getters & Setters in Python
38:09 Bringing it all together in our main.py file!
43:36 Testing our code & Debugging issues
47:20 if name == "__main__" information
48:26 Creating more difficult game levels using our new class structure!
54:00 Fixing the "cheat" where you can go off the screen
55:44 Loading in custom images as the enemy blocks
*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.
Watch video Professional Code Refactor! (Cleaning Python Code & Rewriting it to use Classes) online without registration, duration hours minute second in high quality. This video was added by user Keith Galli 22 March 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 42,218 once and liked it 893 people.