 Okay, welcome to basic animation in Python 3. In this series, I'm going to teach you how to animate your sprites, hopefully in what's a fairly simple manner. But before we do that, I want to talk about what animation is and what we're basically going to be doing. So to do this, I'm going to be importing the turtle module. So I'm going to be using that for our graphics. If you've ever seen any of my other videos, you'll see I use this a lot for simple game programming. I teach middle school and high school students, and I find that it's a lot easier to use this for the basics than it is to use something like PyGame, which of course is awesome. I'm also going to be using something called the time module, and you'll see how we'll use that in a little bit. Now if you're new to the turtle module, here's how we get it set up so that it does stuff. So the first thing we do is we need to create a window, and I called it WN. It doesn't have to be WN. It could be W. It could be Win. It could be anything you want. That's a legal Python variable name. One of the things I should point out is that the editor I am using is called Genie. I get asked this question all the time, G-E-A-N-Y. So you can download that as free as open source, it works on Linux, it works on Mac, and it works on Windows. So I need to set up my turtle screen. So that's the window that we're going to be actually putting things into. I'm going to give it a title just to make it look nice. I'm going to call this Animation Demo, and I'm going to give it a background color of black, and I'm going to enter down, way, way down, and I'm going to make a line called Win.MainLoop, and what this line does is it actually keeps the window open. So I'm going to go ahead and run this and show you what we got. So we've got a blank window. This is the Win. The title is Animation Demo, and the BG, the background color, is black. Now watch what happens when I close this. Okay? Nothing. Return and continue. So that is good sign. We may see some other things later. Now if I didn't have this line here and I run it, it closes right away. So this is not an error. It's not a bug. It's just that the program is doing what you told it to do. So you need to have Window.MainLoop to keep your window open. So let's get to what Animation is. Animation is just changing a picture very slightly from frame to frame, and then combine this looks like some sort of motion. Okay? So we're going to do a very, very simple animation here. So what I'm going to do is I'm going to create a player, and it is a turtle.turtle, parentheses, object, note, capitalization, small t, because that's the module name, and capital T is the class turtle. It's a little confusing because they have the same name, but the capitalization tells you what's what. Again, if you're not familiar with all these terms and things, you know, don't really worry about it for now. It's something maybe you can pick up later. I'm going to give my player a shape, and there are only five built-in shapes I could choose. I'm just going to go with square because I'm kind of boring. So we've got square, circle, triangle, arrow, and turtle. So you can choose whatever you want. And I'm going to give my player a color, and I like green. So I'm going to do green. So note the quotation marks. And again, if you're new to programming, new programmers tend to just type 1,000 lines of code, then run it. It doesn't work. So what we're going to do is we're going to test each section. So far, so good. And I close it, and I got exit code zero. So we are happy with that so far. Now here's where we're going to do the animation. So I'm going to put while true. Again, if you don't know what some of these things are, maybe this isn't the right tutorial to start out on. You may want to start out on a different tutorial. I'll put a link down below if I remember to my basic Python 3 introduction where you can learn how some of these things work before you move on to this tutorial. So what I'm going to do is I'm going to say player.shape square. It's already square, so that's fine. Then I'm going to do this, time.sleep, 0.5. And what that does is it pauses the program for half a second, 0.5 seconds. Then I go player.shape circle, and then again I'm going to time.sleep, 0.5. So this is our basic concept that we're going to be doing. Now when I run this, and by the way, on Genie it's a function f5 to run. We got an error because I typed player wrong. The keyboard on my computer is terrible. So notice real quick, again, beginners. I get a lot of requests for help. I'm happy to help, but they say things like, it doesn't work. It crashes. It doesn't help me. First, I need to know the error message, and I need you to share all of your code with me. Preferably through pacepin.com or some other way, but if you have to, you can try and copy it into the comments. This tells you exactly where the error is. It tells you exactly what the error is. So it doesn't know what playa is. You and I know what playa is, but it does not. So I've got to spell things correctly. Save that, again, function f5 in Genie. Now you notice every half a second, this is now animated. It's not the greatest animation in the world, but it is animated. And we're going to build on this concept as we go along, so we have a little alien character and it's animated a little bit. So that is the end of part one. I'm going to close that. And now you'll see what happens here. We get this error message. You do not have to worry about this error. It just meant that we interrupted the program and it didn't shut down altogether. This is not an error. It's not a problem. Let it go. So yeah, so I'm going to stop there for this one. So basically we've created our little player. It is a turtle. And then we've animated its changing shapes from square to circle every half a second. So come back for part two soon.