__init__.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:spygame 作者: sven1977 项目源码 文件源码
def sloped_xy_pull(self, sprite):
        """
        Applies a so-called xy-pull on a Sprite object moving in x-direction in this sloped tile.
        An xy-pull is a change in the y-coordinate because of the x-movement (sliding up/down a slope while moving left/right).

        :param Sprite sprite: the Sprite object that's moving on the slope
        """
        if self.slope == 0 or not self.slope:
            return
        # the local x value for the Sprite on the tile's internal x-axis (0=left edge of tile)
        x_local = max(0, (sprite.rect.left if self.slope < 0 else sprite.rect.right) - self.rect.left)
        # the absolute y-position that we will force the sprite into
        y = self.rect.bottom - self.get_y(x_local) - sprite.rect.height
        sprite.move(None, y, True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号