__init__.py 文件源码

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

项目:spygame 作者: sven1977 项目源码 文件源码
def check_cliff_ahead(self):
        """
        Checks whether there is a cliff ahead (returns true if yes).
        """
        obj = self.game_object
        tile_w = obj.stage.screen.tmx_obj.tilewidth
        tile_h = obj.stage.screen.tmx_obj.tileheight
        # check below character (c=character sprite, _=locateObject (a stripe with x=x width=w-6 and height=3))
        # ccc    -> walking direction
        # ccc
        #  _
        w = max(tile_w * 1.5, obj.rect.width - 6)
        col = obj.stage.locate((obj.rect.right - tile_w - w) if self.flipped else (obj.rect.left + tile_w),
                               obj.rect.bottom - tile_h * 0.5,
                               w,
                               tile_h * 1.75,
                               Sprite.get_type("default"))
        if not col or isinstance(col.sprite2, LiquidBody):
            return True
        return False

    # checks whether an enemy is in sight
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号