1. Introduction to Pygame ๐๐ปโโ๏ธ๐๐ปโโ๏ธ
PyGame is a library of python language. It is used to develop 2-D games and is a platform where you can set python modules to develop a game. It is a user-friendly platform that helps to build games quickly and easily.
For making a game of your choice there are 3 main questions that need answering. They are as follows:
- What sort of game do you want to build?
- What sort of language do you want to program in?
- What sort of platform do you want to deploy your game to?
Most of the time you can answer each of these questions and find a perfect framework that fits your requirements. Other times, it might not be possible. Consider for example, there arenโt many HTML5 frameworks that allow you to write a high-performance 3D game that you can build.
For PyGame, letโs assume you gave the following answers to the previous 3 questions:
- The game you want to create is graphical, but not 3D.
- You want to program in Python. Also, you already know a little bit of Python
- You want to create a client application that can potentially be wrapped in a standalone executable.
2. Install Pygame in local system โ
- Install and check python present in your local system or not
- Install and check pip is already install in python or not
- Install pygame
insall pygame in our your local system by using this command
pip install pygame
- Check Whether PyGame is Working or not
3. Advantages of using pygame ๐ฏ
There are lots of advantages to using this python library to make codebase on building a game bacause without using this library we have to worry about graphics, timing, files and lot of things things. The advantage behind to using this package are as following:
Easy to install in local system and support any operating system
Pygame is a cross-platform set of Python modules which is used to create video games.
It consists of computer graphics and sound libraries designed to be used with the Python programming language.
Pygame was officially written by Pete Shinners to replace PySDL.
Pygame is suitable to create client-side applications that can be potentially wrapped in a standalone executable.
4. Comparison between Pygame and Pyglet ๐ฎ๐น
Pygame | Pyglet |
---|---|
Easy Python syntax Pygame uses Python as its scripting language. Python is widely treated one of the most natural languages to grasp even for beginners. | 3d support Since pyglet is so firmly merged with OpenGL. It allows the support of drawing in 3D. |
Usage API The API is very straightforward. | Cross-platform It can work with Window, Linux, and OS X. |
Best canvas system Pygame provides a drawing system that allows the user to create and draw an unlimited number of the canvas. | Written in pure Python It can be compiled using the other Python interpreters. |
More popular Pygame is more popular than the pyglet. | Less Popularity Pyglet is less popularee because it has small community support. |
5. Demo ๐
github.com/ADITYADAS1999/python-game_pygame_1
6. References ๐
๐ฉ pygame.org/news
๐ฉ github.com/pygame
๐ฉ python.org
Thats it for this blog. I hope you will try it out and learn something new. Also incase i have missed something feel free to share your thoughts and feedback. Thanks for reading.
Reachout to me ๐
Twitter๐
Linkedin๐
GitHub๐