From the course: Building the Classic Snake Game with Python
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Adding graphics to the snake game - Python Tutorial
From the course: Building the Classic Snake Game with Python
Adding graphics to the snake game
We are now going to spice things up a little bit by adding some graphics to our game. So if you check out branch 03_03b, you'll see we have an assets folder. And in there, we have a background, we have some fruit for our snake, and we have a head for our snake, and we're going to use those now. So in our main program, we go down to Line 111 first of all. And this is where we currently have the bgcolor set to yellow. And what we're going to do is we're going to change that from bgcolor to bgpic, and we're going to have the image for that going to be assets forward slash, and then we'll use the exact name of the image bg2/gif. So when we save and run that, you can see that we now have a background for our game. Okay. Now, what I'm going to do next is I'm going to register a shape for the food and also for the snake head. And the way I do that is I do screen.register_shape. And again, it's going to be assets and the exact name. So for the food, it's snake-food-32 by 32. And while I'm…