Implement a "Save Game" Feature in Python with the shelve Module
Thu 03 May 2012 Al Sweigart
This post goes into the details of how you can add a "save game" feature to your Python games.
Writings from the author of Automate the Boring Stuff.
Thu 03 May 2012 Al Sweigart
This post goes into the details of how you can add a "save game" feature to your Python games.
Fri 06 April 2012 Al Sweigart
To figure out bugs in your code, you might put in print
statements/print()
calls to display the value of variables. Don’t do this. Use the Python logging
module.
Sun 25 March 2012 Al Sweigart
I made a twitter bot that checks every hour for someone who has asked the question, “Why do homeless people have dogs?” and automatically replies, “Because a dog will love you even though you are homeless.”
Mon 19 March 2012 Al Sweigart
CircleMUD was a popular piece of server software for running a MUD, and it came with a sizeable virtual world (which the admin could modify/append to customize their fantasy world.) It would be pretty handy to use parts of this data if you were creating your own virtual world for a text adventure game, but the format of CircleMUD's data files is kind of obtuse and not amenable to manipulation.
So I wrote a few scripts to convert these files into a single XML file which is 4MB when unzipped. You can parse this file and modify it to suit your needs. It contains 1979 rooms across 30 different areas (called zones in the file), with 46 shops and 569 different "mobs" (mobile objects, which are the monsters and NPCs). There are 678 different types of objects, including 116 weapons and 154 types of armor.
Sun 18 March 2012 Al Sweigart
Math and programming have a somewhat misunderstood relationship. Many people think that you have to be good at math or made good grades in math class before you can even begin to learn programming. But how much math does a person need to know in order to program?
Sat 03 March 2012 Al Sweigart
They don’t want to learn how to program just for the sake of programming. They don’t want to learn about algorithm complexity or implicit casting. They want to make Super Mario or Twitter or Angry Birds.
Mon 20 February 2012 Al Sweigart
Fri 10 February 2012 Al Sweigart
I've completed my next book, which focuses on the Pygame library and making graphical games in Python.
Fri 09 December 2011 Al Sweigart
Download pyganim.py and example programs. (Works on both Python 2 and 3.)
Details at http://inventwithpython.com/pyganim/
Pyganim is a module that you can import into your Pygame games to handle sprite animation.
Tue 29 November 2011 Al Sweigart
IDLE is great, but over time I’ve noticed a lot of problems with IDLE that I wish someone would fix.
Fri 21 October 2011 Al Sweigart
Here are a couple games I wrote. The first was so popular that I made a sequel.
Fri 21 October 2011 Al Sweigart
Here's the introductory chapter to my next book on Python and Pygame. It assumes you have some Python and programming experience (if you don't, give a look to Invent with Python), and offers a quick view of all of the major parts of Pygame.
Sun 16 October 2011 Al Sweigart
Yuanle Qiu has started translating the "Invent Your Own Computer Games with Python" into Chinese.
Fri 07 October 2011 Al Sweigart
If you already know a bit of programming and Python, and want to get up to speed on the Pygame 2D game framework, here's a cheat sheet that you can look over. It implements a very short Pygame program covering most of Pygame's basic features.
Wed 28 September 2011 Al Sweigart
I wrote some programs to go through 6 GB of OpenStreetMap data from http://metro.teczno.com so that I could extract a list of street names for an upcoming game project. The game will use procedural generation to create cities, so I need to have a dataset of street names but couldn't easily find one. So I've created this one and wanted to share it.
Tue 20 September 2011 Al Sweigart
I've created a web version of the Caesar Cipher wheel using JQuery and CSS sprites.
Sun 18 September 2011 Al Sweigart
The Caesar Cipher Wheel is a paper cutout that can be used to perform encryption and decryption in the Caesar Cipher. However, if you don't have a printer but do have Python and Pygame installed, you can use this Caesar Cipher Wheel program to rotate a virtual cipher disk instead.
Sat 17 September 2011 Al Sweigart
Draw out horizontal, vertical, or diagonal lines in the same directions that the dot moves. The pattern of the dot's movement becomes longer and longer.
Sat 10 September 2011 Al Sweigart
Pygcurse (pronounced "pig curse") is a curses library emulator that runs on top of the Pygame framework. It provides an easy way to create text adventures, roguelikes, and console-style applications. The mascot of Pygcurse is a blue pig with a skull tattoo on its butt.
Wed 07 September 2011 Al Sweigart
I've decided to make the incomplete rough drafts of my next two Python books available.
Become a Codebreaker with Python
Making Graphical Games with Pygame
The emphasis is on "rough" and "incomplete", but I thought it would be better to give a preview of the direction I was going. These books are also available under a Creative Commons BY-NC-SA license like the first "Invent with Python" book.