Pygame Platformer Tutorial – Full Course
If you are interested in learning how to create a platformer game using Pygame, you have come to the right place! In this full course tutorial, we will cover all the necessary steps to create a fully functional platformer game using the Pygame library in Python.
Getting Started
Before we dive into the tutorial, make sure you have Python and Pygame installed on your computer. If you don’t have Pygame installed, you can install it using pip by running the following command:
pip install pygame
Setting Up the Game
First, we will create a new Pygame project and set up the game window. We will also define the player character and the game loop where all the game logic will be executed.
Creating the Platformer World
Next, we will create the platformer world by adding platforms for the player to jump on. We will also add gravity and collision detection to make the game more realistic.
Adding Enemies and Power-Ups
In this section, we will add enemies for the player to avoid and power-ups to collect. We will also create a scoring system to keep track of the player’s progress.
Adding Graphics and Sound Effects
To make the game more visually appealing, we will add graphics and sound effects. We will also create animations for the player character and the enemies.
Conclusion
Congratulations! You have successfully completed the Pygame platformer tutorial and created your very own platformer game. Feel free to experiment with different features and add your own creative touches to the game.
Happy coding!
Here's a tip: VSCode shows the current object and function I'm editing right under the file tabs, which can help you keep track of where I am at all times.
As of the release of this tutorial, I'm still using Pygame CE. They've actually released another update since I started working on this video as well!
5:15:20
Why does the airtime have to be at zero to avoid showing the jump animation when it can only show the jump animation if airtime is over 4? If you have it set to even 1 (I did this by mistake by incrementing airtime after the downwards collisions detection), it will glitch back and forth between idle and jumping when standing still
4:30:20
hey, I've just started the tutorial and I wanted to know which extensions you have in your VS Code, I don't have much and I would really appreciate it
yo i have problems with uploading sprites without background halp!
I’m using replit for my python game project and I’m very confused as to why the ‘movement’ is labelled as unknown. If anybody could help me that would be greatly appreciated.
3:13:30
1:46:44
How do you play it on fullscreen?
Cool example, just missing the "dead" sfx 😉
where do you get the character and other images from
Could someone help me with the following:
When running after the 2:40:00 mark the tiles that are being placed are transparent instead of full? When I change the alpha of the current_tile_img the placed tiles are not transparent anymore. How can it be that this is not the case in the video.
how many lines of code did you use i am also creating something similar. also how did it take you like thinking of code, formation of ideas etc though the clips say 6hr
The legend drops a bomb!
Great video!
FYI python hack
`NEIGHBOR_OFFSETS = list(product(range(-1,2),range(-1,2)))`
Great video! I've learned a lot of basics about side scrollers, even though I'm following with c++ and raylib instead of python.
Dict keys don't have to be strings in python. Keys just should be immutable. In tilemap you can use pair of ints as keys, since typles and ints are immutable. Turning ints to string and concatenating is also quite slow, not that it matters much in this case.
self.tilemap[(5,3)] = whatever should work fine.
I hope it's okay to ask for such an old video – 1:34:28 is where you talk about the scroll/camera placement related math for both the x-axis and y-axis coordinates. Some elaboration on that would be nice. Couldn't figure out how that actually worked.
This is a lot of fun. I am past the hour mark
One thing: pos[0] // self.tile_size
Why are we dividing the position by tile size here? I understood why you were using the double slash, but not the overall reason for doing this 😅