def CroshairFromXML(entity_xml, layer): return { "entity": Croshair(location=createPygameVector3(entity_xml.location), colour=createPygameColor(entity_xml.colour), scale=float(entity_xml.attrib["scale"])) }
def Croshair_3DFromXML(entity_xml, layer): return { "entity": Croshair_3D(location=createPygameVector3(entity_xml.location), facing=createPygameVector3(entity_xml.facing), vertical=createPygameVector3(entity_xml.vertical), colour=createPygameColor(entity_xml.colour), scale=float(entity_xml.attrib["scale"])) }
def SphereFromXML(entity_xml, layer): return { "entity": Sphere(location=createPygameVector3(entity_xml.location), facing=createPygameVector3(entity_xml.facing), vertical=createPygameVector3(entity_xml.vertical), colour=createPygameColor(entity_xml.colour), radius=float(entity_xml.attrib["radius"])) }
def TriangularPyrimid_WireframeFromXML(entity_xml, layer): return { "entity": TriangularPyrimid_Wireframe( location=createPygameVector3(entity_xml.location), facing=createPygameVector3(entity_xml.facing), vertical=createPygameVector3(entity_xml.vertical), colour=createPygameColor(entity_xml.colour), scale=float(entity_xml.attrib["scale"])) }
def Renderable_2DLineFromXML(entity_xml, layer): return { "entity": Renderable_2DLine(length=float(entity_xml.attrib["length"]), point1=createPygameVector3(entity_xml.facing), point2=createPygameVector3(entity_xml.vertical), colour=createPygameColor(entity_xml.colour), point1_is_midpoint=xml_bool( entity_xml.attrib["point1_is_midpoint"])) }
def Renderable_Simple2DCircleFromXML(entity_xml, layer): return { "entity": Renderable_Simple2DCircle( location=createPygameVector3(entity_xml.location), facing=createPygameVector3(entity_xml.facing), vertical=createPygameVector3(entity_xml.vertical), colour=createPygameColor(entity_xml.colour), radius=float(entity_xml.attrib["radius"])) }
def PlanetFromXML(entity_xml, layer): rotational_period = float(entity_xml.free_body.attrib["rotational_period"]) angular_velocity = 360 / rotational_period if rotational_period != 0 else 0 return {"entity": Planet(radius = float(entity_xml.attrib["radius"]), mass = float(entity_xml.free_body.attrib["mass"]), parentStar = layer.getEntity(entity_xml.attrib["parent_star"]), colour = createPygameColor(entity_xml.colour), location = createPygameVector3(entity_xml.location), facing = createPygameVector3(entity_xml.facing), vertical = createPygameVector3(entity_xml.vertical), initial_velocity = createPygameVector3(entity_xml.free_body.velocity), initial_angular_velocity = angular_velocity), "bound_entities": [binding_tag.text for binding_tag in entity_xml.free_body.getchildren() if binding_tag.tag.split("}")[1] == "bound_entity_name"]}