I am horribly (obssesed?) with writing a visually appealing game (simple) in python. My text adventures didn't appeal to my aufience (family), so I was looking at a tut on making a pac man clone, supposed to be line by line, it seemes choppy. Any ways, here is the code.

#! /usr/bin/env python
import os, sys
import pygame
from pygame.locals import *
from helpers import *
if not pygame.font: print 'Warning, fonts disabled'
if not pygame.mixer: print 'Warning, sound disabled'
class PyManMain:
    """The Main PyMan Class - This class handles the main 
    initialization and creating of the Game."""
    def __init__(self, width=640,height=480):
        """Initialize PyGame"""
        """Set the window Size"""
        self.width = width
        self.height = height
        """Create the Screen"""
        self.screen = pygame.display.set_mode((self.width
                                               , self.height))
    def MainLoop(self):
        """This is the Main Loop of the Game"""
        """Load All of our Sprites"""
        """tell pygame to keep sending up keystrokes when they are
        held down"""
        pygame.key.set_repeat(500, 30)
        """Create the background"""
        self.background = pygame.Surface(self.screen.get_size())
        self.background = self.background.convert()
        while 1:
            for event in pygame.event.get():
                if event.type == pygame.QUIT: 
                elif event.type == KEYDOWN:
                    if ((event.key == K_RIGHT)
                    or (event.key == K_LEFT)
                    or (event.key == K_UP)
                    or (event.key == K_DOWN)):
            """Check for collision"""
            lstCols = pygame.sprite.spritecollide(self.snake
                                                 , self.pellet_sprites
                                                 , True)
            """Update the amount of pellets eaten"""
            self.snake.pellets = self.snake.pellets + len(lstCols)
            """Do the Drawging"""               
            self.screen.blit(self.background, (0, 0))     
            if pygame.font:
                font = pygame.font.Font(None, 36)
                text = font.render("Pellets %s" % self.snake.pellets
                                    , 1, (255, 0, 0))
                textpos = text.get_rect(centerx=self.background.get_width()/2)
                self.screen.blit(text, textpos)
    def LoadSprites(self):
        """Load the sprites that we need"""
        self.snake = Snake()
        self.snake_sprites = pygame.sprite.RenderPlain((self.snake))
        """figure out how many pellets we can display"""
        nNumHorizontal = int(self.width/64)
        nNumVertical = int(self.height/64)       
        """Create the Pellet group"""
        self.pellet_sprites = pygame.sprite.Group()
        """Create all of the pellets and add them to the 
        pellet_sprites group"""
        for x in range(nNumHorizontal):
            for y in range(nNumVertical):
                self.pellet_sprites.add(Pellet(pygame.Rect(x*64, y*64, 64, 64)))        
class Snake(pygame.sprite.Sprite):
    """This is our snake that will move around the screen"""
    def __init__(self):
        self.image, self.rect = load_image('snake.png',-1)
        self.pellets = 0
        """Set the number of Pixels to move each time"""
        self.x_dist = 5
        self.y_dist = 5 
    def move(self, key):
        """Move your self in one of the 4 directions according to key"""
        """Key is the pyGame define for either up,down,left, or right key
        we will adjust outselfs in that direction"""
        xMove = 0;
        yMove = 0;
        if (key == K_RIGHT):
            xMove = self.x_dist
        elif (key == K_LEFT):
            xMove = -self.x_dist
        elif (key == K_UP):
            yMove = -self.y_dist
        elif (key == K_DOWN):
            yMove = self.y_dist
        #self.rect = self.rect.move(xMove,yMove);
class Pellet(pygame.sprite.Sprite):
    def __init__(self, rect=None):
        self.image, self.rect = load_image('pellet.png',-1)
        if rect != None:
            self.rect = rect
if __name__ == "__main__":
    MainWindow = PyManMain()

Anyways, how do I change the sprites used? I see the self.loadSprites function, so I was wondering, how do I edit the sprites this function loads? If neccessary, I will give info on the directories they are placed in.
Also, what should I learn/read to better make (also, easy up the development process) these games. I want to make a rpg pacman clone. Not sure exactly what that means, I guess, pick up weapons, hit points, etx (unles hitpoints are too intermediate I could just have lives).
I want to have more than the black maze backround also. Any ideas/suggestions on how to make this game would be appreciated.
Also, where could I find the most in depth tut on making a first game in python?

10 Years
Discussion Span
Last Post by vegaseat
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.