[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Strange "syntax error"
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Strange "syntax error"
- From: Charles Joseph Christie II <sonicbhoc@xxxxxxxxx>
- Date: Mon, 5 Mar 2007 22:44:04 -0500
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Mon, 05 Mar 2007 22:44:19 -0500
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:date:from:to:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; b=j0LilhWj7ABnLhCk9KxnlpEGsbSJQ0D6qZml1nx0aLX9/F1A23bzL1o8CtEEVHMCGd6cGJsWwL1oHUrRPtxqcRpJel6mqkiu9hVaDQ3vjUIPDK4Z4WIESW6nRNugSxdnLpetNHRk3i3z6NkMP5i2TMyqoTZZHdgdKO29bug7NB8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:from:to:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; b=ZehAWxG2x2G0FxTea2AgPruIjhpKCKN/y2bgi9yUiod/XTyHJnjDUuXR9pgOGRXDfnao8kUlHwWbKPuKgd8QNPF894Cpt+x23d0+ZJBRu64hB4EtVwN77tWrdGoy09xVbeMJSnPgB09LAyk1OoMhF0k4wpo+EuPFLVa+fFbKRfU=
- In-reply-to: <8c46c7370703011814p1cabd5d8k959497460b343945@mail.gmail.com>
- References: <8c46c7370702280527k3d5e800es2d1b0cea028522bf@mail.gmail.com> <1E17E646-A9DC-43F9-8F9D-7B955DF01D39@gmail.com> <6a36e7290702281055m7000505ai5e6a1417cfa35c1a@mail.gmail.com> <20070228161305.15c7076d@compaq> <45E635D4.4000207@canterbury.ac.nz> <45E64E89.9060307@cs.rpi.edu> <45E68BA5.9080008@canterbury.ac.nz> <45E696E8.7070502@cs.rpi.edu> <8c46c7370703011814p1cabd5d8k959497460b343945@mail.gmail.com>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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