Exemplo n.º 1
0
	def draw(self):
		if self.is_actively_controlled_player:
			return
		link.glPushMatrix()
		self.geom.convertIntoReferenceFrame()
		link.set_color(1, 1, 1, 1)
		render.get_model("player_model").render()
		link.glPopMatrix()
Exemplo n.º 2
0
	def draw(self):
		link.glPushMatrix()
		self.geom.convertIntoReferenceFrame()
		link.glScalef(self.gl_scale, self.gl_scale, self.gl_scale)
		if self.damage_state % 12 >= 6:
			link.set_color(0, 0, 0, 1)
		else:
			link.set_color(1, 1, 1, 1)
		render.get_model("jumper").render()
		link.glPopMatrix()
Exemplo n.º 3
0
	def draw(self):
		obj = self.geom
		x, y, z = obj.getPos()
		#t1, t2, t3 = obj.bounds[0]/2.0, obj.bounds[1]/2.0, obj.bounds[2]/2.0
		t1, t2, t3 = self.radius, self.radius, self.radius
		link.glPushMatrix()
		obj.convertIntoReferenceFrame()
#		bounds = [-t1, +t1, -t2, +t2, -t3, +t3]
#		link.draw_box(bounds, "data/crate.png")
		link.set_color(1, 1, 1, 1)
		render.get_model("boulder").render()
		link.glPopMatrix()
Exemplo n.º 4
0
	def init(self, xyz, segment_type):
		self.xyz = xyz
		self.model = render.get_model(segment_type)

		# Extract Bezier curves from the renderer model.
		self.curves = {}
		for curve in self.model.w.metadata["curves"]:
			self.curves[curve["name"]] = compgeom.Bezier(curve["params"])

		# If we're client side we don't try to guess the various objects to be spawned,
		# but instead just wait for the state update to give them to us. So return here.
		if not self.sim.is_server_side:
			return

		for i in xrange(len(self.model.sub_objects)):
			self.sim.add_entity(TerrainSegment, [xyz, segment_type, i])

		# Spawn appropriate entities based on the map's metadata.
		for entity_desc in self.model.w.metadata["entities"]:
			print entity_desc
			thing = entity_desc["type"].lower()
			xyz = entity_desc["xyz"]
			if thing == "spawner":
				# Extract the interval, defaulting to ten seconds.
				print "SPAWNER!"
				interval = entity_desc["properties"].get("interval", 10.0)
				# Look for a key of the form spawn_j, which would be a Jumper spawner.
				spawned_serialization_key = [k for k in entity_desc["properties"] if k.startswith("spawn_")][0][-1]
				self.sim.add_entity(EnemySpawner, [xyz, spawned_serialization_key, interval])
			elif thing.startswith("ser_") and len(thing) == 5:
				# This is a default construction to allow level designers to make objects of any type
				# specifying just serialization key and object coordinates, so we don't need lots of cases.
				constructor = serialization_key_table[thing[-1]]
				self.sim.add_entity(constructor, [xyz])
			else:
				raise ValueError("Unknown entity type: %r" % (thing,))
Exemplo n.º 5
0
	def draw(self):
		link.glPushMatrix()
		self.geom.convertIntoReferenceFrame()
		link.set_color(1, 1, 1, 1)
		render.get_model("cart").render()
		link.glPopMatrix()
Exemplo n.º 6
0
	def init(self, xyz, segment_type, object_index):
		self.model = render.get_model(segment_type)
		self.object_index = object_index
		self.geom = link.BvhTriangleMesh(self.sim.physics, "stone", self.model.sub_objects[object_index].triangles, self.model.sub_objects[object_index].triangles_texture_coords, xyz, (1, 0, 0, 0))