
dofile("powerup_arrowup.lua")

function player_add_player( use_player, player_num )
	dofile_lua( use_player )

	if player_num < 2 then
		if level_num > 100 then
			c_set_use_explosion_for( "multiplier_lost", "flash-1+zzz1", exp_no_align, 0.0, 0.0, 2000.0, 2000.0, {0.0} )
			c_add_particle_to_explosion( "flash-1+zzz1", "explode", "", "score-fooked" )


			local seq = { 0.0, 0.1, 0.5 }
			c_set_use_explosion_for( "levelfailed_extra", "flash-1+zzz2", exp_no_align, 50.0, 0.0, 3000.0, 3000.0, seq )
			c_add_particle_to_explosion( "flash-1+zzz2", "explode", "", "player-flash" )


			local seq = { 0.0 }
			c_set_use_explosion_for( "levelend_extra", "bonus-star+zzz3", exp_no_align, 50.0, 0.0, 2000.0, 2000.0, seq )
			c_add_particle_to_explosion( "bonus-star+zzz3", "explode", "", "stage-end" )
			c_add_particle_to_explosion( "bonus-star+zzz3", "explode", "", "stage-end2" )	


			c_set_use_explosion_for( "stageend_extra", "bonus-star+zzz5", exp_no_align, 0.0, 0.0, 2000.0, 2000.0, {0.0} )
			c_add_particle_to_explosion( "bonus-star+zzz5", "explode", "", "stage-end" )
			c_add_particle_to_explosion( "bonus-star+zzz5", "explode", "", "stage-end2" )	


			c_set_use_explosion_for( "score_extra1", "bonus-star+zzz6", exp_no_align, 0.0, 0.0, 1800.0, 1800.0, {0.0} )
			c_add_particle_to_explosion( "bonus-star+zzz6", "explode", "", "score-twinkle1" )

			c_set_use_explosion_for( "score_extra2", "bonus-star+zzz7", exp_no_align, 0.0, 0.0, 2000.0, 2000.0, {0.0} )
			c_add_particle_to_explosion( "bonus-star+zzz7", "explode", "", "score-twinkle2" )

			c_set_use_explosion_for( "score_extra4", "bonus-star+zzz8", exp_no_align, 0.0, 0.0, 2200.0, 2200.0, {0.0} )
			c_add_particle_to_explosion( "bonus-star+zzz8", "explode", "", "score-twinkle4" )

			c_set_use_explosion_for( "score_extra6", "bonus-star+zzz9", exp_no_align, 0.0, 0.0, 2400.0, 2400.0, {0.0} )
			c_add_particle_to_explosion( "bonus-star+zzz9", "explode", "", "score-twinkle6" )

			c_set_use_explosion_for( "score_extra8", "bonus-star+zzz10", exp_no_align, 0.0, 0.0, 2600.0, 2600.0, {0.0} )
			c_add_particle_to_explosion( "bonus-star+zzz10", "explode", "", "score-twinkle8" )


			c_set_main_event_sound( "score_points", "general_bonus", 1.0 )

		--	if add_bonus_score_particle ~= nil then
		--		c_add_particle_to_explosion( "bonus-star", "explode", "", add_bonus_score_particle )
		--	end
		else
			local seq = { 0.0, 0.1, 0.5 }
			c_set_use_explosion_for( "adventure_completed", "flash-1+zzz2", exp_no_align, 300.0, 0.0, 1200.0, 1800.0, seq )
			c_add_particle_to_explosion( "flash-1+zzz2", "explode", "", "player-flash" )
--			c_add_sound_to_explosion( "flash-1+zzz2", "explode", "player_explosion", 1.0 )
		end
	end
end


function player_start( posx, posy, angle )
	local posz = 0.0
	posy = 40.0
	angle = -90.0

	local player_choose_2 = c_get_player_num( 2 )
	local player_choose = c_get_player_num( 1 )

	-- missile
	dofile("player_missile_1.lua")

	local use_player = format( "player_%d", player_choose )
	player_add_player( use_player, 1 )

	local apo = ACTOR_PreLaunch( use_player )
	apo:setall( posy, posz, -posx, angle, 0.0, 0.0, 0.0, 0.0, 0.0 )
	apo:launch()

	-- player 2
	if player_choose_2 > 0 then
		player_choose_2 = c_get_player_num( 2 )
		use_player = format( "player_%d", player_choose_2 )
		player_add_player( use_player, 2 )

		apo = ACTOR_PreLaunch( use_player )
		posx = -posx
		apo:setall( posy, posz, -posx, angle, 0.0, 0.0, 0.0, 0.0, 0.0 )
		apo:launch()
	end
end

