- Published on
Memory Game in Python + Pygame - Part 4(Final Touches + Running Game)
Welcome back to the Memory Game using Python and Pygame series. This is fourth and final part of the series where we put the final touches and run our finished game.
Here is the YouTube video for the part 4 where we go into much more depth on how to build this game:
Here are the timestamps for this video:
- 0:00 Intro to Part 4
- 0:23 Adding Final Code Block
- 1:25 Running Finished Game
Along with all the supporting links for the video:
- Here is the source code for the game, in case you get stuck: https://github.com/ShehanAT/PythonMiniProjects/tree/master/memoryGame
- If you need to download the image files for the gems used in this game, here is the GitHub repo link to do so: https://github.com/ShehanAT/PythonMiniProjects/tree/master/memoryGame/assets
Video Summary
Here is a quick recap of the important sections covered in the video above:
- First we add the
if __name__ == '__main__'
code block in order to call themain()
method when running the Python script. Note: If you're wondering what the__name__
variable is, it is a special variable in Python that takes on the value of'__main__'
when being run as a Python script(ex:python sample.py
). If the Python script is imported by another script then the value of__name__
would be the name of the Python script, which in this case would besample.py
- Finally we run the application to make sure all aspects and features of the game work as expected, which in hindsight can be said to be true
Conclusion
Congrats if you made it this far as you should have a fully functional Memory Game now 👏
Thanks for following along in this tutorial and if you have any questions or concerns please feel free to post a comment in this article and I will get back to you if I have time.
Well that’s all for today, I hope you found this article helpful. Thanks so much for reading my article! Feel free to follow me on Twitter and GitHub, connect with me on LinkedIn and subscribe to my YouTube channel.