Movement is part of a large portion of games. When jumping between platforms, shooting against a horde of enemies, piloting a space ship and running through the streets, we are causing movement and interacting with the game environment, applying action and causing reactions.
This chapter is to describe the basics of moving objects across the screen and their interaction with other elements through collision detection.
Movement If you are following this series of posts, you already saw an example of movement at the post about the game loop, where we implemented a ball that moves through the screen bouncing around.
Games always connected me with technology since the beginning.
My father and I, we built our first computer (a Pentium 286) and the first thing that I remember to do was to play some DOS games like Prince of Persia and Lunar Lander. I learned a bunch of CLI commands just to play my favorite games.
The passion for playing and making games followed me as a hobby. I have a pygame series of posts on this blog, where I go through basic concepts of game development trying to explain them to someone who is starting to learn about it.
A while ago, I made a post on how to organize a coding dojo that was published right after the Python DF community anniversary dojo where I prepared a challenge to create the game of life from John Horton Conway.
To let the challenge more dynamic, I prepared a graphic simulator using pygame so everyone could see the code running visually. The simulator uses all the concepts that we saw on the last posts of this series.
Now that we learned how to draw on the screen (previous post) would be good that our game keeps running until someone closes it, and to do that we will use one of the basic concepts of game development with is the Game Loop.
Concept The concept of loop is something very common at computing, it is nothing but a sequence of actions and decision makings that repeats inside on a cycle.
During a game lifetime, we are constantly drawing on the screen. Now that we learned how to create a program with pygame it’s time to start to draw.
Drawing axis Going back to math classes at high school we were introduced to the Cartesian coordinate system. It is basically one bidimensional plane oriented by the axis x and y where the x values grow from left to right while y grows from bottom to top:
Game development is one of the most common reasons to start to study programming. With me it was not different, despite not following the game developer path, this was always a field that caught my attention.
I’m creating this series of posts to learn more about the game development basics and to share my discoveries with everyone. I’ll use the pygame library as tool and I will start by the most basic principles of game development until the creation of a single player pong like game.