本文整理汇总了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")
示例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()
示例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)
示例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)
示例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()
示例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()
示例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)
示例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)
示例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)
示例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)
示例11: __init__
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import __init__ [as 别名]
def __init__(self, model):
Entity.__init__(self, model)
self.create_collisions()
示例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)
示例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