How to Make A Platformer Game with Python! PyGame Tile-Based Platformer Tutorial!

Опубликовано: 11 Октябрь 2024
на канале: LeMaster Tech
3,264
87

In this video, as a special thank you for one amazing year of making videos with you all on LeMaster Tech YouTube, I show you to make a full tile-based platformer game start to finish using python and the PyGame module!!

For the full code and all accompanying assets for this project - check out the GitHub link here:
https://github.com/plemaster01/SpaceP...

And if you love the content on the channel and want to become a super SUPER supporter of the channel, check out my Patreon link below:
  / lemastertech  

If you want to learn to build a level editor like the one used to create the levels in this game, check out my previous video on the channel!
   • How to Code a Level Editor Using Pyth...  

Thank you so much for one awesome year and over 1700 subs!! Be sure to leave a like and subscribe to the channel to stay up to date with all the awesome content in the years to come!!! And don't forget to drop a comment letting me know what you thought and what you'd like to see next!

For a full platformer game, we start by setting up PyGame, then using a 2-D array and a series of nested for loops we draw all our different tiles and objectives onto the board.

Then we handle player movement and control as well as collision with obstacles and gravity and a jumping mechanic! Then we set up a teleport mechanism to move between levels and phases, then we create the code for handling losing and winning as well as restarting the game.

The final steps are timing the total run for high scoring and then handling collision with acid tiles so you lose a life when you hit acid, and lose when you run out of lives! Then we quickly add some sound effects and background music and we are all done!

If you have any questions about what you saw in this video or ideas for what you'd like to see in a future video just let me know in the comments of this video!!

Thanks for watching and goodluck with your code!!

Timestamps:
00:00:00 Introduction, Thanks You and Project Showcase
00:07:20 Setting Up Basic Pygame Window
00:12:12 Loading All Game Images In
00:26:50 Drawing Tiles Onto Screen
00:44:30 Drawing Player Onto Screen
01:01:35 Moving In X-Direction and Collisions
01:25:00 Jumping, Landing and Using Gravity
01:37:35 Level Structure and Importing Separate .py files
01:43:06 Drawing the Inventory Part One
01:53:40 Teleporting Through Portals and Moving Through Levels
02:10:37 Drawing Instructions and Scores In Inventory
02:24:17 Collision with Acids and Losing Lives
02:31:30 Winning, Losing, End Scores and Restarting
02:44:01 Tracking Time, High Scores, Saving and Loading from External Text Files
02:56:30 Adding Sound Effects and Background Music
03:04:10 Outro and Final Discussion