Esempio n. 1
0
 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"]))
     }
Esempio n. 2
0
 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"]))
     }
Esempio n. 3
0
 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"]))
     }
Esempio n. 4
0
 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"]))
     }
Esempio n. 5
0
 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"]))
     }
Esempio n. 6
0
 def StarFromXML(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": Star(radius = float(entity_xml.attrib["radius"]),
                            mass = float(entity_xml.free_body.attrib["mass"]),
                            temperature = float(entity_xml.attrib["tempriture"]),
                            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"]}
Esempio n. 7
0
 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"]}
Esempio n. 8
0
 def CroshairFromXML(entity_xml, layer):
     return {
         "entity":
         Croshair(location=createPygameVector3(entity_xml.location),
                  colour=createPygameColor(entity_xml.colour),
                  scale=float(entity_xml.attrib["scale"]))
     }