[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Strange "syntax error"



I have come to the decision that this idea would make a great sequel,
But for now I don't want to throw away the work I've already done. So,
without further ado...

I got hit with a syntax error, but I don't see it anywhere. Does
anybody see it?

It's on line 17. I don't see it though...

On Thu, 1 Mar 2007 21:14:10 -0500
"Charles Christie" <sonicbhoc@xxxxxxxxx> wrote:

> I know the basics of both Python and C, I took robotics and the
> robot's programming was done in C.
> I've learned how to use C but I've never actually done it, though.
> I've read code, went bug hunting and used code in a robot but I've
> never actually done something on my own in it yet.I know a little
> python from what I've been doing with my game so far. I'm just trying
> to think which direction I should take it. I had better make up my
> mind soon...
> 
> I'd like to experiment with SWIG and C... but I don't know if I have
> enough time for that. I'm afraid that if I do it wrong I'll waste too
> much time and have nothing good to present for my project...
> 
> Hmm. It's a difficult decision.
##Character class. This is where the main playable STG character actions will be defined.

import pygame
from pygame.locals import *
from helpers import *

class Charsprite(pygame.sprite.Sprite):
    def __init__(self, pix, x, y):
        pygame.sprite.Sprite.__init__(self)
        self.update()
        self.x = x
        self.y = y
        self.sprite = load_image(pix)
    def update(self):
        self.image = self.sprite
        self.image.blit = (self.image, (0, 0)
        self.rect = self.image.get_rect()
        self.rect.center = (self.x, self.y)

##class Playersprite(Charsprite):
##    def __init__(self):
##    def update(self):
##        
##
##class Bosssprite(Charsprite):
##    def __init__(self):
##    def update(self):
##        
##
##class Lifebar(Charsprite):
##    def __init__(self):
##    def update(self):
##        
##helpers.py - has all the stuff for importing images and sounds and other helpers I might want
import pygame, os, sys
from pygame.locals import *

def load_image(name, colorkey=None):
    fullname = os.path.join('data', name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error, message:
        print 'Unable to load ', name, '!'
        raise SystemExit, message
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image, image.get_rect()
    
def load_sound(name):
    class NoneSound:
        def play(self): pass
    if not pygame.mixer:
        return NoneSound()
    fullname = os.path.join('data', name)
    try:
        sound = pygame.mixer.Sound(fullname)
    except pygame.error, message:
        print 'Unable to load ', wav, '!'
        raise SystemExit, message
        return sound