Thanks for sharing! I sometimes using pygame so this will be a useful reference.
Quick thought while reading through, for areas of code where you have lots of if/elif/else statements, you might find the match statement which was introduced in Python 3.10 useful: docs.python.org/3/tutorial/controlflow.html