Pygame is a cross between C++ and Python. Pygame is actually a module, to use it you do import pygame. It lets you make cool games with actual visual effects, in its own screen. Pygame comes built in to Raspberry Pi.
I actually first heard about it when Martin O’Hanlon used it in his blog post about sound effects in Minecraft Pi. He made it so when you jumped, or fell, or hit something, it would play a sound. He used Pygame. Pygame has many uses, and its main use is for programming visual games, as I said before.
But it can also be used to simply play sounds. When I first heard about it, I thought it was something built for the Pi (Pygame, PiGame…
.). I looked into it, and I started using it for sounds and music. I have also made a music MP3 and WAV player, which you can see on my channel (http://www.
youtube.com/scarabcoder). I had also gotten a request from someone to help make a snake game, and it was written in Python and Pygame. He had already made the game, and I played it.
It was really cool. The person who made it also wanted multiplayer, between two people. Of course, then I knew little or no Pygame coding, so I couldn’t really help. Now, I’ve looked online for tutorials and soon learned it.
I made a simple back-and-forth boinging ball, which was simple. It just went back and forth across the screen. Then my Dad introduced me to a book (I forgot the name..
.) that was all about randomization. For example, a certain NPC (Naturally generated person, or something) would randomly walk around, and others would have a 40% chance to attack the player, a 30% chance to run away, and a 30% chance to just chat. The book was mostly about C++, but I got plenty of ideas from the book.
I made two large circles, one black and one red. They would just move around randomly, go straight for about 30 pixels, then go another random direction. I then made the player, a little pixel character that my sister made for me (she is an artist 🙂 ) which could be controlled with the usual WASD keys. Here are some pictures (including the little pixel guy):