Ejemplo n.º 1
0
    def __init__(self, ev_manager, charactor, group=None, location=(0, 0)):
        super(CharactorSprite, self).__init__(group)

        self.ev_manager = ev_manager
        self.ev_manager.registerListener(self)

        self.__tweener = pytweener.Tweener()

        self.charactor = charactor

        aux = Surfaces.listSurface(SurfaceImage('walk_front2.png'), (3, 1))
        self.images = {DIRECTION_DOWN: aux}
        aux = Surfaces.listSurface(SurfaceImage('walk_sleft2.png'), (3, 1))
        self.images.update({DIRECTION_LEFT: aux})
        aux = Surfaces.listSurface(SurfaceImage('walk_sright2.png'), (3, 1))
        self.images.update({DIRECTION_RIGHT: aux})
        aux = Surfaces.listSurface(SurfaceImage('walk_back2.png'), (3, 1))
        self.images.update({DIRECTION_UP: aux})

        self.rect = aux[0].get_rect()
        self.rect.topleft = location

        self.last_direction = DIRECTION_DOWN
        self.image = self.images[self.last_direction][self.STAND]

        self.last_move = 1  # last move who took charactor
        self.is_moving = 0  # if is moving
        self.__time = 0  # to make transition of images when is moving
        self.__has_change = 0  # to change images when is moving in a time
        self.__delay = MTS * (1 / 2.)  # delay to change a certain frame
Ejemplo n.º 2
0
    def __init__(self, ev_manager, charactor, group=None, location=(0,0)):
        super(CharactorSprite, self).__init__(group)

        self.ev_manager = ev_manager
        self.ev_manager.registerListener(self)

        self.__tweener = pytweener.Tweener()

        self.charactor = charactor

        aux = Surfaces.listSurface(SurfaceImage('walk_front2.png'), (3,1))
        self.images = {DIRECTION_DOWN : aux}
        aux = Surfaces.listSurface(SurfaceImage('walk_sleft2.png'), (3,1))
        self.images.update({DIRECTION_LEFT : aux})
        aux = Surfaces.listSurface(SurfaceImage('walk_sright2.png'), (3,1))
        self.images.update({DIRECTION_RIGHT : aux})
        aux = Surfaces.listSurface(SurfaceImage('walk_back2.png'), (3,1))
        self.images.update({DIRECTION_UP : aux})

        self.rect = aux[0].get_rect()
        self.rect.topleft = location
        
        self.last_direction = DIRECTION_DOWN
        self.image = self.images[self.last_direction][self.STAND]

        self.last_move = 1 # last move who took charactor
        self.is_moving = 0 # if is moving
        self.__time = 0 # to make transition of images when is moving
        self.__has_change = 0 # to change images when is moving in a time
        self.__delay = MTS*(1/2.) # delay to change a certain frame
Ejemplo n.º 3
0
 def __init__(self, sector, group=None, location=(0, 0)):
     super(SectorSprite, self).__init__(group)
     grounds = SurfaceImage('Tileset- ground.png')
     default_grounds = Surfaces.listSurface(grounds, (13, 8))
     self.images = default_grounds
     self.image = Surfaces.scale(default_grounds[0], (SIZE_TILE, SIZE_TILE))
     self.rect = self.image.get_rect()
     self.rect.topleft = location
     self.topleft = location
     self.sector = sector
Ejemplo n.º 4
0
 def __init__(self, sector, group=None, location=(0,0)):
     super(SectorSprite, self).__init__(group)
     grounds = SurfaceImage('Tileset- ground.png')
     default_grounds = Surfaces.listSurface(grounds, (13, 8))
     self.images = default_grounds
     self.image = Surfaces.scale(default_grounds[0], (SIZE_TILE, SIZE_TILE))
     self.rect = self.image.get_rect()
     self.rect.topleft = location
     self.topleft = location
     self.sector = sector
Ejemplo n.º 5
0
 def __init__(self, sector, group=None, location=(0, 0)):
     super(UmiSector, self).__init__(sector, group, location)
     self.image = self.images[40]
     self.image = Surfaces.scale(self.image, (SIZE_TILE, SIZE_TILE))
     self.rect = self.image.get_rect()
     self.rect.topleft = location
Ejemplo n.º 6
0
 def __init__(self, sector, group=None, location=(0,0)):
     super(UmiSector, self).__init__(sector, group, location)
     self.image = self.images[40]
     self.image = Surfaces.scale(self.image, (SIZE_TILE, SIZE_TILE))
     self.rect = self.image.get_rect()
     self.rect.topleft = location