def prepare(self): super(Mimic,self).prepare() self.real_obj = self.obj self.real_pieces = self.pieces fname = self.getstyle("mimic-filename","wall.obj") self.mimic_obj = objpart.get_obj(fname) if self.hiding: self.obj = self.mimic_obj self.pieces = self.mimic_obj.pieces()
from tdgl import part, objpart, viewpoint, panel, animator from tdgl.vec import Vec import collision, levelfile # vertical and horizontal spacing of hexagons Vspace = 3**0.5 Vhalf = Vspace / 2 hexcorners = [ (v.x, v.y) for v in collision.H_CORNER ] def hex_to_world_coords(col,row): x,y,_ = collision.h_centre(col,row) return x,y TILE_OBJECTS = { "#":objpart.get_obj("wall.obj"), "H":objpart.get_obj("hex.obj"), "^":objpart.get_obj("nwall.obj"), "v":objpart.get_obj("swall.obj"), ">":objpart.get_obj("ewall.obj"), "<":objpart.get_obj("wwall.obj"), "O":objpart.get_obj("trickwall.obj"), "Au":objpart.get_obj("goldhex.obj"), "Ag":objpart.get_obj("silverhex.obj"), "Cu":objpart.get_obj("copperhex.obj"), "Pt":objpart.get_obj("plathex.obj"), "L":objpart.get_obj("lava.obj"), } def cellcolour(cellcode): c = cellcode[:1]