＼＼\ ٩(๑❛ワ❛๑)و //／／
So far, all of our codes have only used text. The text is displayed on the screen as output and the user types in text from the keyboard as input. This is simple, and an easy way to learn to program. But from this post onward, plain text output won’t be the case. This post might teach you how to use the Pygame library to make games with graphics, animation, and sound.
In these posts, we’ll find the source code for simple programs that are not games but demonstrate the Pygame concepts I have tried to convey. Links to my drive will present the source code for a complete Pygame game using all the concepts you should have learned by then.
I should have mentioned this earlier…A software library
is a code that is not meant to be run by itself but included in other programs to add new features. By using a library a programmer doesn’t have to write the entire program, but can make use of the work that another programmer has done before them.
Pygame is a software library that has modules for graphics, sound, and other features that games commonly use.
Okay so that being said , I am just gonna dive into the concepts,cause I am like super drained ,so yeah…,I hope you don’t feel like this is a compilation of some leaked out notes of a Mad Scientist.
Pygame does not come with Python. But like Python, Pygame is available for free. You will have to download and install Pygame, which is as easy as downloading and installing the Python interpreter,which you might have already done, assuming you have read the previous posts with sincerity and devotion .
I am gonna assume that you have the Windows operating system, but Pygame works the same for every operating system. You need to download the Pygame installer for your operating system and the version of Python you have installed (2.7
). For Windows, download the msi file
. (This is Pygame for Python 2.7 on Windows. If you installed a different version of Python (such as 2.5 or 2.4) download the .msi file
for your version of Python.)
ps: I recommend downloading 2.7 pythons since it is the most (as far as I know) stable and has stable and legal versions of the libraries I had specified earlier.In case you have already downloaded a higher version and have gotten an error,I might not be able to help you.But if you do feel like negating my statement do comment your wishes or mail me or just ignore the following .
The current version of Pygame is 1.9.2. But if you see a newer version on the website, download and install the newer Pygame. For Mac OS X and Linux, follow the directions on the download page for installation instructions.
On Windows, double-click on the downloaded file to install Pygame. To check that Pygame is install correctly, type the following into the IDLE:
>>> import pygame
If nothing appears after you hit the Enter key, then you know Pygame has successfully been installed.
If the error ImportError: No module named pygame appears
, then try to install Pygame again (and make sure you typed import pygame correctly).
Check your paths right click on Computer(icon) got to Properties and click on Advanced system settings.Go to environmental variables.Update the following paths.
#Case sensitive #
Path ;C:\Python27(remove the previous version of python and do this i.e.. change 34 to 27)
*Hope this helps you… let me know if it is otherwise*
Okay, so, this time, I will put a link here to my drive that has five small programs that demonstrate how to use the different features that Pygame provides. In one of them, you will use these features for a complete game written in Python with Pygame.