In a previous post — Games with Turtle Graphics — I proposed a general game plan 😉 for implementing Pong with Turtle graphics. In this post and the previous, I explain how to translate that game plan to working code, piece by piece. In part 1 we put the building blocks in place, and in this post we’ll implement the game’s logic.
In the previous post — Games with Turtle Graphics — I proposed a general game plan 😉 for implementing Pong with Turtle graphics. In this post and the next, I explain how to translate that game plan to working code, piece by piece. In this post we’ll put the building blocks in place, and in part 2 we’ll implement the game’s logic.
In previous posts we have discussed how animations and games are simulations of the real world. For these simulations to be authentic, the objects in them have to move realistically and thus they must obey the laws of Physics. Of course, you may want your game or animation to have different physical laws. But even then, you have to understand the laws in order to break them in a plausible way.
In this post we’ll discuss the fundamental concepts needed to analyse the motion of macroscopic objects. These concepts are valid whether we want to simulate motion on a computer or consider it in real life.
In the previous post — Animation with Turtle Graphics — I explained that animation is simply simulation, making stuff appear real. You create the appearance of real and continuous movement by quickly showing a series of slightly-different images. I then introduced the idea of creating animations with Python’s turtle graphics module. In this post, I’ll use a simple example to explain how to use animation as well as user interaction and data to create a game with turtle graphics.
All animation (indeed, all moving pictures) is fundamentally nothing more than consecutive pictures being shown so quickly that it simulates continuous motion. Each picture is called a frame. Each frame must differ from the previous one slightly, and quickly showing the frames one after the other gives the illusion of continuous motion, hence the word ‘animate’ as in ‘bring to life’. The frames have to be shown at a rate of about 12 or more frames per second (fps) for a person to experience them as an animation. Modern film generally uses 24 frames per second.
You can’t learn to speak — to say things — without learning to say something. And you can’t learn to program — to talk to a computer — without learning to program something. Learning to program therefore not only provides the opportunity to learn to instruct a computer, but is also an opportunity to learn about everything else in the world.
When learning something new, by coming to understand its fundamental elements or building blocks you’ll not only learn more, and more exciting things, but have a greater amount of expressive power with that knowledge. It is essential, however, that the process of learning those detailed fundamentals takes place with the big picture always in mind, and in sight. Literally as well: appropriate visuals greatly improve the learning process by serving as memory and reasoning aids.