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


Python Character.set_speed方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import set_speed [as 别名]
	def __init__(self, *args):
		super(Swordsman, self).__init__(*args)
		Character.set_health(self, Swordsman.MAX_HEALTH)
		Character.set_speed(self, Swordsman.MOVE_SPEED)
		actor = Actor("models/swordsman", 
						{"idle": "models/swordsman-idle", 
						 "walk": "models/swordsman-walk", 
						 "run": "models/swordsman-run", 
						 "hurt": "models/swordsman-hurt", 
						 "die": "models/swordsman-die", 
						 "attack": "models/swordsman-attack"})

		team = Character.get_team(self)
		if team == 0:
			"""
			actor = Actor("models/swordsman_red", 
						{"idle": "models/swordsman-idle", 
						 "walk": "models/swordsman-walk", 
						 "run": "models/swordsman-run", 
						 "hurt": "models/swordsman-hurt", 
						 "die": "models/swordsman-die", 
						 "attack": "models/swordsman-attack"})
			"""
			tex = loader.loadTexture("models/textures/swordsman_red.png")
			ts = actor.findTextureStage('*')
			actor.setTexture(ts, tex, 1)
			#ts = actor.findTextureStage('ts')
			#actor.setTexture(ts, tex)
		elif team == 1:
			"""
			actor = Actor("models/swordsman_blue", 
						{"idle": "models/swordsman-idle", 
						 "walk": "models/swordsman-walk", 
						 "run": "models/swordsman-run", 
						 "hurt": "models/swordsman-hurt", 
						 "die": "models/swordsman-die", 
						 "attack": "models/swordsman-attack"})
			"""
			tex = loader.loadTexture("models/textures/swordsman_blue.png")
			ts = actor.findTextureStage('*')
			actor.setTexture(ts, tex, 1)
			#ts = actor.findTextureStage('ts')
			#actor.setTexture(ts, tex)
		
		Character.set_actor(self, actor)
		self.hb = HealthBar(1.5, value=Swordsman.MAX_HEALTH)
		self.hb.reparentTo(self._floater)
		self.hb.setValue(self.get_health())
		
		self.model = loader.loadModel("models/circle")
		self.model.setTransparency(True)
		self.model.reparentTo(self._character)
		self.model.setAlphaScale(0.5)
		self.model.setScale(2)
		self.model.setPos(0, 0, -10)
开发者ID:jaimodha,项目名称:MMOG,代码行数:57,代码来源:Swordsman.py

示例2: __init__

# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import set_speed [as 别名]
    def __init__(self, *args):
        super(Axeman, self).__init__(*args)
        Character.set_health(self, Axeman.MAX_HEALTH)
        actor = Actor("models/axeman", {"idle": "models/axeman-idle", 
                                        "walk": "models/axeman-walk", 
                                        "run": "models/axeman-run" ,
                                        "hurt": "models/axeman-hurt", 
                                        "die": "models/axeman-die", 
                                        "attack": "models/axeman-swing", 
                                        "special":"models/axeman-special-attack"})
        Character.set_speed(self, Axeman.MOVE_SPEED)

        # loda texture based on team 
        team = Character.get_team(self)
        if team == 0:
            tex = loader.loadTexture("models/textures/axeman_red.png")
            ts = actor.findTextureStage("*")
            actor.setTexture(ts, tex, 1)
        elif team == 1:
            tex = loader.loadTexture("models/textures/axeman_blue.png")
            ts = actor.findTextureStage('*')
            actor.setTexture(ts, tex, 1)

        Character.set_actor(self, actor)

        #attach axe 
        rightHand = self._character.exposeJoint(None, 'modelRoot', 'hand_ctrl_r')
        axe = loader.loadModel("models/axe")
        axe_tex = loader.loadTexture("models/textures/axe.png")
        axe.setTexture(axe_tex, 1)
        axe.setPos(-3.0, 0.6, -0.2)
        axe.setHpr(0, -90, -90)
        axe.setScale(10)
        axe.reparentTo(rightHand)
        axe.show()

        self.hb = HealthBar(1.5, value=Axeman.MAX_HEALTH)
        self.hb.reparentTo(self._character)
		
        model = loader.loadModel("models/circle")
        model.setTransparency(True)
        model.reparentTo(self._character)
        model.setAlphaScale(0.5)
        model.setScale(2)
        model.setPos(0, 0, -10)
开发者ID:jaimodha,项目名称:MMOG,代码行数:47,代码来源:Axeman.py


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