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


Python ParticleEffect.setR方法代码示例

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


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

示例1: __init__

# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import setR [as 别名]
class Ship:

    def __init__(self, game):

        self.game = game

        self.shipPoint = NodePath(PandaNode("shipFloaterPoint"))
        self.shipPoint.reparentTo(render)

        self.x_pos = 0
        self.z_pos = 0

        self.x_speed = 0
        self.z_speed = 0

        self.x_pid = PID(3.0, 5.0, 1.0)
        self.z_pid = PID(3.0, 5.0, 1.0)

        self.model = Actor("data/ship.egg")

        self.model.setPos(0, 0, 0)
        self.model.setHpr(0, 0, 0)

        self.normal_speed = 3.5
        self.low_speed = 2

        self.speed = self.normal_speed

        self.cool_down = 0.1
        self.last_shoot = 0

        self.keyMap = {

            "up": 0,
            "down": 0,
            "left": 0,
            "right": 0,

            "brake": 0,

            "attack": 0,
        }

        # This list will stored fired bullets.
        self.bullets = []

        self.game.accept("mouse1", self.setKey, ["attack", 1])
        self.game.accept("mouse1-up", self.setKey, ["attack", 0])

        self.game.accept("shift-mouse1", self.setKey, ["attack", 1])
        self.game.accept("shift-mouse1-up", self.setKey, ["attack", 0])

        self.game.accept("x", self.setKey, ["attack", 1])
        self.game.accept("x-up", self.setKey, ["attack", 0])

        self.game.accept("c", self.setKey, ["brake", 1])
        self.game.accept("c-up", self.setKey, ["brake", 0])

        self.game.accept("arrow_up", self.setKey, ["up", 1])
        self.game.accept("arrow_up-up", self.setKey, ["up", 0])

        self.game.accept("arrow_down", self.setKey, ["down", 1])
        self.game.accept("arrow_down-up", self.setKey, ["down", 0])

        self.game.accept("arrow_left", self.setKey, ["left", 1])
        self.game.accept("arrow_left-up", self.setKey, ["left", 0])

        self.game.accept("arrow_right", self.setKey, ["right", 1])
        self.game.accept("arrow_right-up", self.setKey, ["right", 0])

    def setKey(self, key, value):
        self.keyMap[key] = value

    def draw(self):
        self.model.reparentTo(render)

        self.p = ParticleEffect()
        self.p.loadConfig(Filename('data/particles/fireish.ptf'))

        self.p.setR(180)
        self.p.setScale(0.25)
        # Sets particles to birth relative to the teapot, but to render at
        # toplevel
        self.p.start(self.model)
        self.p.setPos(0.000, 0.000, 0.000)

    def update(self, task):
        dt = globalClock.getDt()

        if self.model:

            # Movement

            if self.keyMap["brake"]:
                self.speed = self.low_speed
            else:
                self.speed = self.normal_speed

            if self.game.ship_control_type == 0:

#.........这里部分代码省略.........
开发者ID:JauriaStudios,项目名称:HostilGalaxy,代码行数:103,代码来源:ship.py


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