import api_game as api_game
import game_1 as quest_game

str_path_img="data\\img\\"
str_img_menu=str_path_img+"menu\\game\\object_select.jpg"

music_location="data\\sound\\lost-night-beach.ogg"

def on_create():
	global music_location
	api_game.load_stream(music_location,1)
	api_game.fade_music(music_location,0,3)

	str_path_icon=str_path_img+"lev\\"+__name__+"\\objects_icon\\"
	str_path_m_icon=str_path_img+"lev\\"+__name__+"\\items\\"
	quest_game.set_path_small_icon(str_path_img+"lev\\"+__name__+"\\icons\\")

	api_game.load_stream("data\\sound\\quest\\amb_waterfall.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\amb_waterfall.ogg",0.5)
	api_game.play_sound("data\\sound\\quest\\amb_waterfall.ogg",1)

	api_game.load_stream("data\\sound\\quest\\amb_les_water.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\amb_les_water.ogg",0.7)
	api_game.play_sound("data\\sound\\quest\\amb_les_water.ogg",1)

	api_game.enable_visibility(0,"o5_6", 0)
	api_game.enable_visibility(0,"second_object", 0)
	api_game.enable_visibility(0,"fifth_object", 0)
	api_game.enable_visibility(0,"plot", 0)
	api_game.enable_visibility(0,"three_object", 0)

	str_icons_menu=[str_path_icon+"item1_1.jpg",str_path_icon+"item1_2.jpg",str_path_icon+"item1_3.jpg",str_path_icon+"item1_4.jpg",str_path_icon+"item1_5.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"item1_1m.jpg",str_path_m_icon+"item1_2m.jpg",str_path_m_icon+"item1_3m.jpg",str_path_m_icon+"item1_4m.jpg",str_path_m_icon+"item1_5m.jpg","","",""]
	str_objects_on_loc=["item1_1","item1_2","item1_3","item1_4","item1_5","","",""]
	quest_game.add_of("first_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 1.5,80,0)

	str_icons_menu=[str_path_icon+"item2_1.jpg",str_path_icon+"item2_2.jpg",str_path_icon+"item2_3.jpg",str_path_icon+"item2_4.jpg",str_path_icon+"item2_5.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"item2_1m.jpg",str_path_m_icon+"item2_2m.jpg",str_path_m_icon+"item2_3m.jpg",str_path_m_icon+"item2_4m.jpg",str_path_m_icon+"item2_5m.jpg","","",""]
	str_objects_on_loc=["item2_1","item2_2","item2_3","item2_4","item2_5","","",""]
	quest_game.add_of("second_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 3.14,0,0)

	str_icons_menu=[str_path_icon+"item3_1.jpg",str_path_icon+"item3_1.jpg",str_path_icon+"item3_1.jpg",str_path_icon+"item3_1.jpg",str_path_icon+"item3_1.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"item3_1m.jpg",str_path_m_icon+"item3_1m.jpg",str_path_m_icon+"item3_1m.jpg",str_path_m_icon+"item3_1m.jpg",str_path_m_icon+"item3_1m.jpg","","",""]
	str_objects_on_loc=["item3_1","item3_2","item3_3","item3_4","item3_5","","",""]
	quest_game.add_of("doski_break", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, -1.4,0,0)

	str_icons_menu=[str_path_icon+"item4_1.jpg",str_path_icon+"item4_1.jpg",str_path_icon+"item4_1.jpg",str_path_icon+"item4_1.jpg",str_path_icon+"item4_1.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"item4_1m.jpg",str_path_m_icon+"item4_1m.jpg",str_path_m_icon+"item4_1m.jpg",str_path_m_icon+"item4_1m.jpg",str_path_m_icon+"item4_1m.jpg","","",""]
	str_objects_on_loc=["item4_1","item4_2","item4_3","item4_4","item4_5","","",""]
	quest_game.add_of("fourth_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 1.5,0,0)

	str_icons_menu=[str_path_icon+"item5_1.jpg",str_path_icon+"item5_1.jpg",str_path_icon+"item5_1.jpg",str_path_icon+"item5_1.jpg",str_path_icon+"item5_1.jpg","","",""]
	str_icon_mouse=[str_path_m_icon+"item5_1m.jpg",str_path_m_icon+"item5_1m.jpg",str_path_m_icon+"item5_1m.jpg",str_path_m_icon+"item5_1m.jpg",str_path_m_icon+"item5_1m.jpg","","",""]
	str_objects_on_loc=["item5_1","item5_2","item5_3","item5_4","item5_5","","",""]
	quest_game.add_of("fifth_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 1.5,0,0)

	quest_game.set_collect_sound("first_object","data\\sound\\quest\\q_fall_wooden.ogg")
	quest_game.set_collect_sound("fifth_object","data\\sound\\quest\\q_skrip.ogg")

	quest_game.set_state_of("first_object", 2)

	api_game.set_goal("goal_8_1")

def on_mouse_down_of(object_name, p_object, state):
	if object_name == "first_object" and state == 3:
		quest_game.show_object("o5_6","quest_anim",0.3,0,0)
		quest_game.show_object("second_object","quest_anim",0.3,0,0)
		api_game.play_anim(0,"first_object","quest_anim",0.5,1)
		api_game.play_anim(0,"termitnik","quest_anim",0.5,1)
		quest_game.set_state_of("second_object", 2)
		api_game.set_goal("goal_8_2")
	elif object_name == "second_object" and state == 3:
		quest_game.show_object("termitnik","quest_anim",0.5,0,0)
		api_game.play_anim(0,"second_object","quest_anim",0.5,1)
		
		api_game.attach_game("data\\menu\\levels\\loc_8_2")
#		import game_2 as ant_game
#		ant_game.cnt_collect(30)
#		ant_game.cnt_simult(7)                
#		ant_game.init_object("ant_1","ant_1_go", 1, 4, 0)
#		ant_game.init_object("ant_2","ant_2_go", 1, 5, 0)
#		ant_game.init_object("ant_3","ant_3_go", 1, 4, 0)
#		ant_game.init_object("ant_4","ant_4_go", 1, 5.2, 0)
#		ant_game.init_object("ant_5","ant_5_go", 1, 4.5, 0)
#		ant_game.init_object("ant_6","ant_6_go", 1, 5.3, 0)
#		ant_game.init_object("ant_8","ant_8_go", 1, 4, 0)	
#		ant_game.init_object("ant_7","ant_7_go", 1, 5.5, 0)
#		ant_game.init_object("ant_9","ant_7_go", 1, 5.1, 0)
#		ant_game.init_object("ant_10","ant_7_go", 1, 5, 0)
		api_game.activate_game("loc_8_2",1)
		api_game.set_goal("tut_8_2")
	elif object_name == "doski_break" and state == 3:
		api_game.set_goal("goal_8_4")
		quest_game.show_object("three_object","quest_anim",0.5,0,0)
		api_game.play_anim(0,"doski_break","quest_anim",0.5,1)
		quest_game.set_state_of("fourth_object", 2)
	elif object_name == "fourth_object" and state == 3:
		api_game.set_goal("goal_8_5")
		api_game.play_anim(0,"three_object","quest_anim",0.5,1)
		quest_game.show_object("fifth_object","quest_anim",0.5,0,0)
		quest_game.set_state_of("fifth_object", 2)
	elif object_name == "fifth_object" and state == 3:
		api_game.play_anim(0,"fifth_object","quest_anim",0.5,1)
		api_game.play_anim(0,"plot","quest_anim",0.5,0)

		 
def on_event(object_name, p_object, event):
	if event == 11000 and object_name == "loc_8_2":
		api_game.activate_game("loc_8_2",0)
		quest_game.set_state_of("doski_break", 2)
	elif event == 11004 and object_name == "loc_8_2":
		api_game.fade_off(1,"")
		api_game.set_goal("goal_8_3")



def on_stop_anim(object_name, anim_name, p_object, i_track):
	if object_name == "plot":
		api_game.game_win()
