Nice work.
A couple criticisms:
I have a pretty minimal snake game here which has a very basic scene manager if you want to check it out:
https://github.com/Mekire/Snake/blob/master/snake.py
A couple criticisms:
- Speed is global, this is unnecessary.
- You are constraining your framerate to 10 fps. This is not a great way to slow your program down.
- You aren't handling quit events making exiting from the program a little annoying.
- Your color constants aren't actually necessary; pygame provides all standard html colors already.
- Loop through objects, not indexes. For example, instead of this:
This:
- Try to minimize repeated code like this block:
Often you can use a dictionary to switch to the correct case in situations like this; the following illustrates the basic idea:
I have a pretty minimal snake game here which has a very basic scene manager if you want to check it out:
https://github.com/Mekire/Snake/blob/master/snake.py