Send to a Friend

iamnothuman's avatar

Python Code error?

Asked by iamnothuman (9points) November 10th, 2009

this is my code:
import pygame
from random import randint
from pygame.locals import *
screen_size=(840,840)

class enemy(pygame.sprite.Sprite):
def __init__ (self,x,y):
pygame.sprite.Sprite.__init__(self)
self.image=image_load(“enemy.jpg”)
self.rect=self.image.get_rect()
self.rect.centerx=x
self.rect.centery=y
def update(self, time_passed):
pass
def main():
hidden=False

enemy1=enemy((400,400))
screen=pygame.display.set_mode ((640,480))
pygame.display.set_caption(“Time Crisis!”)
clock=pygame.time.Clock()
background=pygame.surface.Surface(screen_size).convert()
cursor=pygame.image.load(“shooterdot.jpg”).convert()
background.fill((0,0,0))
pygame.init()
while True:
for event in pygame.event.get():
if event.type==QUIT:
exit()
screen.blit(background,(0,0))
x,y=pygame.mouse.get_pos()
x-=cursor.get_width()/2
y-=cursor.get_height()/2
screen.blit(cursor ,(x,y))
pygame.display.update()

if __name__ ==“__main__”:
main()

this is the error:
Traceback (most recent call last):
File “c:\Users\Owner\Documents\code\pyhton\shooter.py”, line 38, in <module>
main()
File “c:\Users\Owner\Documents\code\pyhton\shooter.py”, line 18, in main
enemy1=enemy((400,400))
TypeError: __init__() takes exactly 3 arguments (2 given)

help?

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.