Getting started with Pygame

Getting started with Pygame

Pygame intro

As with every other kid out there, I spent long hours sitting in front of the computer playing Games like Super Mario, Dangerous Dave and the likes. So when I got to know about Pygame. I was really getting the itch on creating something in the lines of these games.

Of cource, we have better game engines written in other languages like C++, but since I liked python. So I mean what the heck right?

Lets Get Started then shall we

Installation

Ubuntu/Debian

$ sudo apt-get install python-pygame

OS X

If you DON’T have homebrew installed, then

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If you have it installed, then

$ brew install caskroom/cask/brew-cask
$ brew cask install xquartz
$ brew install python3
$ brew install python
$ brew linkapps python3
$ brew linkapps python
$ brew install git
$ brew install sdl sdl_image sdl_ttf portmidi libogg libvorbis
$ brew install sdl_mixer --with-libvorbis
$ brew tap homebrew/headonly
$ brew install smpeg
$ brew install mercurial
$ pip3 install hg+http://bitbucket.org/pygame/pygame

See if it works?

Open the terminal

$ python
Python 2.7.8 (default, Jun 18 2015, 18:54:19) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>>

If there is no Error on that, then you are good to go.

A simple Pygame Boilerplate

I made a dead simple Pygame boilerplate for creating a base for your pygame programs.

Here is the Github link for you.

A sneak peak

What can you do with this?

I created Space Shooter using this boilerplate. Here’s a demo screen for you

References

All content is licensed under the CC-BY 4.0 License unless otherwise specified