当前位置: 首页>>代码示例>>Python>>正文


Python Inventory.transfer方法代码示例

本文整理汇总了Python中inventory.Inventory.transfer方法的典型用法代码示例。如果您正苦于以下问题:Python Inventory.transfer方法的具体用法?Python Inventory.transfer怎么用?Python Inventory.transfer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在inventory.Inventory的用法示例。


在下文中一共展示了Inventory.transfer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Actor

# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import transfer [as 别名]

#.........这里部分代码省略.........
    def _collide_actor(self, other):
        coll.collide_actor_actor(self, other)

    def _collide_hit_zone(self, other):
        coll.collide_actor_hit_zone(self, other)

    def _collide_slash(self, other):
        coll.collide_actor_slash(self, other)

    def activate_trigger(self, trigger):
        self.dispatch_event("on_activate_trigger", trigger, self)

    def put_item(self, item):
        self.inventory.put_item(item)

    def open(self):
        self.inventory.open()

    def close(self):
        self.inventory.close()

    def destroy(self):
        """
        Remove Actor from level
        """
        if self.fight_group > 0:
            for armor in filter(lambda x: (x.attached is not None), self.body.body_parts):
                armor.attached.drop()
            self.fight_group = -1
            self.remove_action(self.actions[0])
            self.kill()
            self.dispatch_event("on_death", self)

    def transfer(self):
        self.inventory.transfer()
        super(Actor, self).transfer()
        self.ground_count = 0
        self.on_ground = True

    # @activity
    def move(self, horizontal_direction):
        """
        Move Actor in horizontal_direction with his body speed
        """
        if self.on_ground:
            d = horizontal_direction * self.body.speed
            self.b2body.linearVelocity.x = d
            if self.direction != horizontal_direction:
                self.turn()

    @activity
    def stand(self):
        """
        Do not move Actor
        """
        self.b2body.linearVelocity.x = 0

    @activity
    def sit(self):
        self.b2body.linearVelocity.x = 0

    def turn(self):
        self.direction = -self.direction
        self.body.turn()

    def push(self, v):
开发者ID:Ecialo,项目名称:Codename-Parzalon,代码行数:70,代码来源:actor.py


注:本文中的inventory.Inventory.transfer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。