コード例 #1
0
ファイル: tile.py プロジェクト: jodonnell/python_game
    def __init__(self, id, abs_pos):
        image = pygame.image.load(os.path.join(*TILE_PROPERTIES[id]["image_path"]))
        self.image = image.convert_alpha()
        rect = self.image.get_bounding_rect()
        self._right_bound = abs_pos[0] + rect.width
        self._left_bound = abs_pos[0]

        Sprite.__init__(self, abs_pos)
コード例 #2
0
ファイル: player.py プロジェクト: jodonnell/python_game
    def __init__(self, startPos, control):
        """The constructor takes a tuple startPos which will be used as the players starting position, it also takes a control object that contains 
        the players control configuration"""
        self.load_frames()
        self.image = self._STILL_RIGHT_FRAME['image']
        self.control = control

        self.movement_speed = 4
        self.jump_speed = 12

        Sprite.__init__(self, startPos)
        self.rect.left = startPos[0] - self.rect.width

        self.state = States(self)