__init__.py 文件源码

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

项目:spygame 作者: sven1977 项目源码 文件源码
def __init__(self, key, command, flags=0, other_command=None, animation_to_complete=None):
        """
        :param str key: the key's description, e.g. `up` for K_UP
        :param str command: the `main` command's description; can be any string e.g. `fire`, `jump`
        :param int flags: keyboard-command behavior flags
        :param str other_command: a possible second command associated with the key (when key is released, e.g. `release_bow`)
        :param Union[list,str] animation_to_complete: animation(s) that needs to be completed in order for the other_command to be executable
        """

        self.key = key
        self.command = command

        assert flags & (self.BLOCK_REPEAT_UNTIL_ANIM_COMPLETE | self.BLOCK_OTHER_CMD_UNTIL_ANIM_COMPLETE) == 0 or \
            isinstance(animation_to_complete, str) or isinstance(animation_to_complete, set), "ERROR: animation_to_complete needs to be of type str or set!"

        self.flags = flags
        self.other_command = other_command
        # this could be a set of anims (one of them has to be completed)
        self.animation_to_complete = {animation_to_complete} if isinstance(animation_to_complete, str) else animation_to_complete
        self.state_other_command = 0  # the current state for the other_command (charging, charged, cmd_received)

        self.is_disabled = False  # set to True for temporarily blocking this translation
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号