jueves, 15 de octubre de 2015

Utilizando la clase Gato (ok, con un carro)


import pygame
from pygame.locals import *

class Gato(pygame.sprite.Sprite):
    speed = 5
    bounce = 24
    images = []
    def __init__(self):
        pygame.sprite.Sprite.__init__(self,self.containers)
        self.image=self.images[0]
        self.rect = self.image.get_rect()

    def inf(self):
        print self.speed
        print self.bounce
        print self.images

def main():
    pygame.init()
    disp=pygame.display.set_mode((400,400))
    img=pygame.image.load('./DataImgs/car.png')
    all = pygame.sprite.RenderUpdates()
    Gato.containers = all      
    Gato.images=[img]
    gato = Gato()
    gato.inf()

if __name__=='__main__': main()



#Solo por mostrar variables locales (pero publicas via instancia).

No hay comentarios:

Publicar un comentario