def __init__(self, ev_manager, charactor, group = None): pygame.sprite.DirtySprite.__init__(self, group) self.ev_manager = ev_manager self.ev_manager.registerListener(self) 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.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 * 2./3 # delay to change a certain frame
def __init__(self, sector, group=None): pygame.sprite.Sprite.__init__(self, group) grounds = SurfaceImage('Tileset- ground.png') default_ground = Surfaces.listSurface(grounds, (13, 8))[19] self.image = Surfaces.scale(default_ground, (SIZE_TILE, SIZE_TILE)) self.rect = self.image.get_rect() self.sector = sector
def __init__(self, sector, group=None): pygame.sprite.DirtySprite.__init__(self, group) grounds = SurfaceImage('Tileset- ground.png') default_ground = Surfaces.listSurface(grounds, (13, 8))[40] self.image = Surfaces.scale(default_ground, (SIZE_TILE, SIZE_TILE)) self.rect = self.image.get_rect() self.sector = sector
def __init__(self, ev_manager, charactor, group = None): pygame.sprite.Sprite.__init__(self, group) self.ev_manager = ev_manager self.ev_manager.registerListener(self) 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.image = self.images[DIRECTION_DOWN][self.STAND] self.last_direction = DIRECTION_DOWN self.last_move = 1 self.is_moving = 0