import bge

def ai(cont):  
#    own = cont.owner
#    scene = bge.logic.getCurrentScene()
#    #actu = cont.actuators['start_level']
#    dict = bge.logic.globalDict
#    objList = scene.objects
#    mainDir = bge.logic.expandPath("//")
#    skater = 'ai_ed'
#    
#    fileName = mainDir + "npc_skaters/" + str(skater) + '.blend'    
#    
#    path = bge.logic.expandPath(fileName)
#    bge.logic.LibLoad(path, 'Scene') 
#    

#    # get object named MainCharacter
#    armature = objList["npc_ed_arm"]

#    # combine child's shape with parent's
#    compound = True

#    # child is solid
#    ghost = False

#    # set parent
#    armature.setParent( own, compound, ghost) 
    
    print('loading ai') 

def main(cont):
    own = cont.owner
    scene = bge.logic.getCurrentScene()
    actu = cont.actuators['start_level']
    dict = bge.logic.globalDict
    mainDir = bge.logic.expandPath("//")
 #   if dict['char_loaded'] == 0:
    fileName = mainDir + "characters/" + str(dict["character"]) + '.blend'    
    
    path = bge.logic.expandPath(fileName)
    try:
        bge.logic.LibLoad(path, 'Scene')  
    except:
        pass    
    
    fileName = mainDir + "assets/" + 'bmx_player' + '.blend'    
    
    path = bge.logic.expandPath(fileName)
    bge.logic.LibLoad(path, 'Scene')     
    fileName = mainDir + "assets/" + 'prop_bike.blend'    
    
    path = bge.logic.expandPath(fileName)
    bge.logic.LibLoad(path, 'Scene') 
#        dict['char_loaded'] = 1
    
    
#    fileName = mainDir + "characters/sun.blend"    
#    
#    path = bge.logic.expandPath(fileName)
#    bge.logic.LibLoad(path, 'Scene')      


    cont.activate(actu)
    