def __init__ (self, target_map_name = 'my-map',
               target_x = 0.0, target_y = 0.0, **kwargs):
     GameObject.__init__(self, **kwargs)
     Lockable.__init__(self, **kwargs)
     Scriptable.__init__(self, **kwargs)
     Trapable.__init__(self, **kwargs)
     self.attributes.append("door")
     self.target_map_name = target_map_name
     self.target_pos = (target_x, target_y)
     self.blocking = True
Example #2
0
    def __init__(self, ID, agent_layer=None, inventory=None, text="", **kwargs):
        GameObject.__init__(self, ID, text=text, **kwargs)
        Living.__init__(self, **kwargs)
        CharStats.__init__(self, **kwargs)

        self.behaviour = None

        if inventory == None:
            self.inventory = Inventory()
        else:
            self.inventory = inventory

        self.state = _AGENT_STATE_NONE
        self.layer_id = agent_layer.getId()
        self.createBehaviour(agent_layer)
Example #3
0
    def loadAttributes(self, tyles, data):
        graphs = {}
        for tyle in tyles:
            name = tyle.data['name']
            if not name in graphs:
                graphs[name] = graph.Graph()
            (x, y, w, h) = tyle.rect()
            p0 = (x, y)
            p1 = (x + w, y)
            p2 = (x + w, y + h)
            p3 = (x, y + h)
            graphs[name].addEdge(p0, p1)
            graphs[name].addEdge(p1, p2)
            graphs[name].addEdge(p2, p3)
            graphs[name].addEdge(p3, p0)

        for key in graphs.keys():
            info = {}
            info = data[key]
            g = graphs[key]

            cs = g.getCicles()
            for poly in cs:
                block = GameObject.GameObject(self.world)
                block.collider = Collider.PolygonCollider(
                    block, 0, 0, self.toVector2(poly))
                self.world.AddObject(block)
                if 'static' in info.keys():
                    block.collider.static = info['static']
                if 'trigger' in info.keys():
                    block.collider.isTrigger = info['trigger']
                if 'light' in info.keys():
                    light = block.addComponent(LightSource.SpotLight)
                    if 'intensity' in info.keys():
                        light.intensity = int(info['intensity'])
                    if 'radius' in info.keys():
                        light.radius = int(info['radius'])
 def __init__(self, item_type, **kwargs):
     GameObject.__init__(self, **kwargs)
     Carryable.__init__(self, **kwargs)
     Usable.__init__(self, **kwargs)
     self.item_type = item_type
Example #5
0
 def __init__(self):
     self.scene = None
     gameobject = GameObject()
     self.go_to(TitleScene(gameobject))
Example #6
0
 def getStateForSaving(self):
     """Returns state for saving
     """
     ret_dict = GameObject.getStateForSaving(self)
     ret_dict["Inventory"] = self.inventory.serializeInventory()
     return ret_dict