__init__.py 文件源码

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

项目:spygame 作者: sven1977 项目源码 文件源码
def tick(self, game_loop):
        """
        Needs to be called by the GameObject at some point during the GameObject's `tick` method.

        :param GameLoop game_loop: the currently playing GameLoop object
        """
        obj = self.game_object

        self.reset()

        if self.game_obj_cmp_anim and self.game_obj_cmp_anim.flags & Animation.get_flag("paralyzes"):
            return

        # look for edges ahead -> then change direction if one is detected
        # - makes sure an enemy character does not fall off a cliff
        if (not (game_loop.frame % 3) and self.check_cliff_ahead()) or obj.rect.x <= 0 or obj.rect.x >= obj.x_max:
            self.toggle_direction()

        self.commands["left" if self.flipped else "right"] = True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号