Demo entry 2445061

www.learnpygame.com

   

Submitted by www.learnpygame.com on Aug 21, 2015 at 00:55
Language: Python. Code size: 644 Bytes.

    def __init__(self, name, x, y, itemType, image, sound=None):#-adjust this
        '''x: x coordinate
        y: y coordinate
        itemType: a dict with one key value pair {'item_name':quantity}
        image: image string
        sound: sound string'''
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load(image).convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.name = name#--------add this
        self.itemType = itemType
        self.load_sound(sound)

    def get_name(self):#--------add this
        return self.name

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).