def spawn(self): if not self.representation: actual_object_size = Size( self.settings["tile_size"].width * self.settings["scale"] * game.settings.get('screen')["scale"], self.settings["tile_size"].height * self.settings["scale"] * game.settings.get('screen')["scale"]) self.representation = gameobject.GameObject( self.settings["name"], self.settings["position"], actual_object_size, self.charset_lib["default"]) game.add(self.representation)
def spawn(self): if not self.representation: actual_object_size = Size(self.settings["tile_size"].width * self.settings["scale"] * game.settings.get('screen')["scale"], self.settings["tile_size"].height * self.settings["scale"] * game.settings.get('screen')["scale"]) self.representation = gameobject.GameObject(self.settings["name"], self.settings["position"], actual_object_size, self.charset_lib["default"]) game.add(self.representation)
def read_levels(self): for level_name, level in self.levels.items(): level.tileset = level.settings["tileset"] level.heightmap = level.settings["heightmap"] level.terrainmap = level.settings["terrainmap"] if "tile_width" in level.settings: level.tile_width = int(level.settings["tile_width"]) if game.settings.get('debug')['on']: debug(level.settings, "Loaded Level " + level_name) for object_name, object_settings in level.settings["gobjects"].items(): gobject_from_level_dict = game.add( gameobject.GameObject(object_name, Position(object_settings['position'][0], object_settings['position'][1]), Size(object_settings["size"][0], object_settings["size"][1]))) gobject_from_level_dict.chimg(object_settings["image"])