コード例 #1
0
ファイル: graphics.py プロジェクト: siht/tiled_mvc
 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
コード例 #2
0
ファイル: graphics.py プロジェクト: siht/tiled_v0.0.1
    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
コード例 #3
0
ファイル: graphics.py プロジェクト: siht/tiled_v0.0.1
 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
コード例 #4
0
ファイル: graphics.py プロジェクト: siht/flappy-bird
 def __init__(self, position=(0,0)):
     pygame.sprite.Sprite.__init__(self)
     self.image = SurfaceImage('background.png').wrap
     self.image = Surfaces.scale(self.image,
                                 (WINDOW_SIZE[0] + 9, WINDOW_SIZE[1] - 100)
                                )
     self.rect = self.image.get_rect()
     self.rect.topleft = position
コード例 #5
0
ファイル: graphics.py プロジェクト: siht/tiled_mvc
 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
コード例 #6
0
ファイル: graphics.py プロジェクト: siht/flappy-bird
    def __init__(self, position=(0,0)):
        pygame.sprite.Sprite.__init__(self)
        self.images = {Bird.RIGHT:[]}
        aux = SurfaceImage('bird1.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        self.images[Bird.RIGHT].append(aux)
        aux = SurfaceImage('bird2.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        self.images[Bird.RIGHT].append(aux)
        aux = SurfaceImage('bird3.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        self.images[Bird.RIGHT].append(aux)
        ##
        self.images.update({Bird.UP:[]})
        aux = SurfaceImage('bird1.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, 30)
        self.images[Bird.UP].append(aux)
        aux = SurfaceImage('bird2.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, 30)
        self.images[Bird.UP].append(aux)
        aux = SurfaceImage('bird3.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, 30)
        self.images[Bird.UP].append(aux)
        ##
        self.images.update({Bird.DOWN0:[]})
        aux = SurfaceImage('bird1.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, -30)
        self.images[Bird.DOWN0].append(aux)
        aux = SurfaceImage('bird2.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, -30)
        self.images[Bird.DOWN0].append(aux)
        aux = SurfaceImage('bird3.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, -30)
        self.images[Bird.DOWN0].append(aux)
        ##
        self.images.update({Bird.DOWN1:[]})
        aux = SurfaceImage('bird1.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, -90)
        self.images[Bird.DOWN1].append(aux)
        aux = SurfaceImage('bird2.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, -90)
        self.images[Bird.DOWN1].append(aux)
        aux = SurfaceImage('bird3.png')
        aux = Surfaces.scale(aux.wrap, BIRD_SIZE)
        aux = Surfaces.rotate(aux, -90)
        self.images[Bird.DOWN1].append(aux)

        self.__index_image = 0
        self.__inc = True
        self.__want_flap = 0
        self.__flap_delay = 2
        self.__facing = Bird.RIGHT
        self.__wants_fly = False
        self._my_tweener = pytweener.Tweener()
        self.__aps = 0
        self.__im_flying = True
        self.alive = True

        self.image = self.images[self.__facing][self.__index_image]
        self.rect = self.image.get_rect()
        self.radius = 38
        self._x, self._y = position
        self.rect.topleft = position
コード例 #7
0
ファイル: graphics.py プロジェクト: siht/flappy-bird
 def __init__(self, position=(WINDOW_SIZE[0] + 25, 500)):
     pygame.sprite.Sprite.__init__(self)
     self.image = SurfaceImage('ground.png').wrap
     self.image = Surfaces.scale(self.image, FLOOR_SIZE)
     self.rect = self.image.get_rect()
     self.rect.topleft = position
コード例 #8
0
ファイル: graphics.py プロジェクト: siht/flappy-bird
 def __init__(self, position=(WINDOW_SIZE[0]+TUBE_SIZE[0], -20)):
     Pipe.__init__(self, position)
     self.image = Surfaces.flip(self.image, False, True)
コード例 #9
0
ファイル: graphics.py プロジェクト: siht/flappy-bird
 def __init__(self, position=(WINDOW_SIZE[0]+TUBE_SIZE[0], 400)):
     pygame.sprite.Sprite.__init__(self)
     self.image = SurfaceImage('pipe.png').wrap
     self.image = Surfaces.scale(self.image, TUBE_SIZE)
     self.rect = self.image.get_rect()
     self.rect.topleft = position