def setup_armies(): global red_army_units global blue_army_units NROWS = 4 NCOLS = math.ceil(ARMY_SIZE / NROWS) assert math.ceil(NROWS / 2) * SPACING < MAP_HEIGHT // 2 assert math.ceil(NCOLS / 2) * SPACING < MAP_WIDTH // 2 # (0,0) is the center of the map for r in range(int(-NROWS // 2), int(NROWS // 2 + NROWS % 2)): for c in range(int(-NCOLS // 2), int(NCOLS // 2 + NCOLS % 2)): x = -(r * SPACING) + 35 z = c * SPACING y = pf.map_height_at_point(x, z) knight = rts.units.knight.Knight("assets/models/knight", "knight.pfobj", "Knight") knight.pos = (float(x), float(y), float(z)) knight.rotation = DIR_RIGHT knight.faction_id = 0 knight.selection_radius = 3.25 knight.selectable = True knight.vision_range = 35.0 knight.hold_position() red_army_units += [knight] x = (r * SPACING) - 35.0 z = c * SPACING y = pf.map_height_at_point(x, z) berz = rts.units.berzerker.Berzerker("assets/models/berzerker", "berzerker.pfobj", "Berzerker") berz.pos = (float(x), float(y), float(z)) berz.rotation = DIR_LEFT berz.faction_id = 1 berz.selection_radius = 3.00 berz.selectable = True berz.vision_range = 35.0 berz.hold_position() blue_army_units += [berz]
def __update_objects_for_height_change(self): for obj in globals.active_objects_list: obj.pos = [ obj.pos[0], pf.map_height_at_point(obj.pos[0], obj.pos[2]), obj.pos[2] ]