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


Python Entity.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
    def __init__(self, map, position):

        print "New player"

        Entity.__init__(self)
        self._lock = None
        self._phys = Verlet(position)
        self._phys.setDamping((0.02, 0.02, 0.0002))
        self._phys.setGravity((0, 0, -0.00006))

        self._on_floor = False
        self._speed = 0

        self._map = map
        self._heading = 0
        self.reset()

        r = self._radius = 0.1

        self.setBounds(((-r, -r, -r), (r, r, r)))  # entity stuff
        Entity.moveTo(self, position)  # keep the entity updated

        self._scaling = T.scale_matrix(self._radius)

        self._last_pos = N.array((0, 0, 0), dtype="f")

        self._graphics = R.loadObject("sphere.obj", "diffuse")
开发者ID:Gato-X,项目名称:NotYourData,代码行数:29,代码来源:player.py

示例2: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
    def __init__(self, scene, pos, dest, router):
        Entity.__init__(self)
        self._destroyed = False
        self._closing = False
        self._target_reached = False

        self._scene = scene
        self._map = scene.getMap()

        self._path = None

        self._dying_t = 0
        self._spin = 0

        self.moveTo(pos)

        self._scale = 1.0
        self._graphics = R.loadObject("enemy.obj","diffuse")
        self._orient_m= T.identity_matrix()

        self._xform_m = N.dot(T.rotation_matrix(math.pi/2,(0,0,1)),T.scale_matrix(self._scale))

        bounds = self._graphics.getObj().getBounds()

        router.requestJob(pos, dest, Enemy.OnRouteObtained, self)

        Entity.setBounds(self,bounds * self._scale)
        self._destroyed = False
        self._old_time = 0

        self._old_pos = None # At t-1
        self._old_pos2 = None # At t-2

        self._hc = HeadingController()
开发者ID:Gato-X,项目名称:NotYourData,代码行数:36,代码来源:enemy.py

示例3: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
    def __init__(self, pos=Vector(0, 0), rot=0.0):
        """Creates a new Ship

        Args:
            pos: the position of the ship
            rot: the rotation of the ship

        Returns:
            a new Ship instance
        """

        # Get the initial direction of the ship using the rotation
        direction = Vector(cos(radians(rot)), sin(radians(rot)))

        # Initially, the ship isn't moving
        self._movement = Vector.zero()

        # Initialize bullet list
        self.bullets = []
        self._last_shoot = self._shoot_delay
        self._last_teleport = self._teleport_delay
        self.teleport_up = True
        self.effect_player = EffectPlayer.instance()
        Entity.__init__(self, (20, 0, -30, 20, -30, -20), direction,
                        lin_speed=1.0, rot_speed=2.0, pos=pos, rot=rot,
                        scale=0.5)
开发者ID:Cheeser12,项目名称:pysteroids,代码行数:28,代码来源:player.py

示例4: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
    def __init__(self, scene, pos):
        Entity.__init__(self)
        self._destroyed = False
        self._closing = False

        self._scene = scene

        self.moveTo(pos)

        self._graphics = R.loadObject("targetpt.obj","diffuse")
        self._beacon = R.loadObject("beacon.obj","glow")

        self._anim_m = T.identity_matrix()
        self._rot= T.quaternion_about_axis(0, (0,0,1))
        self._rot_speed = T.quaternion_about_axis(0.01, (0,0,1))

        self._scale = 0.15

        self.moveTo(self.getPosition() + (0,0,-0.3))

        self._scale_m = T.scale_matrix(self._scale)

        bounds = self._graphics.getObj().getBounds() * self._scale

        Entity.setBounds(self,bounds)
开发者ID:Gato-X,项目名称:NotYourData,代码行数:27,代码来源:targetpoint.py

示例5: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
    def __init__(self, poi_type, red, black):
        Entity.__init__(self, poi_type, red, black)
        self.width = 90
        self.height = 90
        self.offsetRed = self.height/2
        self.offsetBlack = self.width/2

        self.conceal()
开发者ID:marlusclayton,项目名称:flashpoint,代码行数:10,代码来源:pois.py

示例6: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
 def __init__(self, door_type, red, black, red_link, black_link):
     Entity.__init__(self, door_type, red, black)
     self.red_link = red_link
     self.black_link = black_link
     self.key = "door-{}-{}-{}-{}".format(red, black, red_link, black_link)
     self.width = 100
     self.height = 100
     self.set_offset()
     self.close()
开发者ID:marlusclayton,项目名称:flashpoint,代码行数:11,代码来源:doors.py

示例7: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
    def __init__(self, pos, particles):
        Entity.__init__(self)

        self._particles = particles

        self.moveTo(pos)

        self._graphics = R.loadObject("base.obj","diffuse")
        self._anim_m = T.identity_matrix()

        bounds = self._graphics.getObj().getBounds()

        Entity.setBounds(self,bounds)
开发者ID:Gato-X,项目名称:NotYourData,代码行数:15,代码来源:base.py

示例8: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
  def __init__(self, texture = None, position = Point2(0, 0), depth = 55, scale = 1,
               transparency = True):
    Entity.__init__(self, "shapes/plane")
    self.prime.reparentTo(base.camera)
    self.prime.setPos(Point3(position.getX(), depth, position.getY()))
    self.prime.setScale(scale)

    # tells panda3d to not care about what order to draw the sprite in, prevents
    # z-fighting
    self.prime.setBin("unsorted", 0)

    # tells panda3d not to check if something has been drawn in front of it
    self.prime.setDepthTest(False)
    if transparency:
      self.prime.setTransparency(1)

    if texture:
      self.texture = base.loader.loadTexture(APP_PATH + "media/textures/" +
                                             texture + ".png")
      self.prime.setTexture(self.texture, 1)
开发者ID:KingAbbott,项目名称:devsyn,代码行数:22,代码来源:sprite.py

示例9: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
 def __init__(self, unique_id, entity_type=EntityType.find(100), name='Unnamed entity', state=STATE_UNKNOWN, state_value=None, last_checkin=0):
     Entity.__init__(self, unique_id, entity_type, name=name, state=state, state_value=state_value, last_checkin=last_checkin)
开发者ID:rycus86,项目名称:IntelliHomeControl-py,代码行数:4,代码来源:power_generic.py

示例10: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
 def __init__(self, role, player, red, black):
     Entity.__init__(self, role, red, black)
     self.set_player(player)
     self.role = role
     self.image_name = "assets/firefighters/{}_{}.png".format(self.role, self.player.color)
开发者ID:marlusclayton,项目名称:flashpoint,代码行数:7,代码来源:firefighters.py

示例11: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
 def __init__(self, model):
   Entity.__init__(self, model)
   self.create_collisions()
开发者ID:KingAbbott,项目名称:devsyn,代码行数:5,代码来源:player.py

示例12: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
 def __init__(self, hazard_type, red, black):
     Entity.__init__(self, hazard_type, red, black)
     self.image_name = "assets/tokens/{}.png".format(self.entity_type)
开发者ID:marlusclayton,项目名称:flashpoint,代码行数:5,代码来源:hazards.py

示例13: __init__

# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
    def __init__(self, scene, pos, direction, missile_type, follow):
        Entity.__init__(self)

        self._t0 = None
        self._follow = follow

        self._scene = scene

        self._map = scene.getMap()

        self.moveTo(pos)

        self._thrust = 0.01
        self._speed = 0.1

        self._destroyed = False

        self._graphics = R.loadObject(missile_type+".obj","diffuse")
        self._pos_m = T.translation_matrix(pos)


        axis = T.random_vector(3)

        self._d_rotation = T.quaternion_about_axis(0.01, axis)
        self._rotation = T.random_quaternion()

        self._dir = direction

        scale = 0.05

        self._scaling_m = T.scale_matrix(scale)

        bounds = self._graphics.getObj().getBounds() * scale

        Entity.setBounds(self,bounds)

        self._trail= ParticleGenerator("billboard","puff.jpg")
        self._trail.setEvolveTime(0.5)
        self._trail.setAcceleration(0)
        self._trail.setEasing(0.5, 0.5, 0.0, 0.05, 0.2)
        self._trail.setBrightness(0.5)

        pg = scene.getParticleManager()

        def em(t):
            while True:
                dx = 2.*random.random()-1.
                dy = 2.*random.random()-1.
                dz = 2.*random.random()-1.

                r = dx*dx+dy*dy+dz*dz

                if r < 1.0:
                    break

            return self._pos,(dx*0.2,dy*0.2,dz*0.2)

        self._trail.setEmitter(em)
        self._trail.setMode("DYNAMIC")

        pg.manageGenerator(self._trail)

        self._last_z = 0
开发者ID:Gato-X,项目名称:NotYourData,代码行数:65,代码来源:missile.py


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