-- events 

timer = 0
particletimer = 0

function OnLoad ()
	--SetProperty ("/:enable_event_on_key_down", 1);
	SetProperty ("/:enter_trans_duration", 0.4);
	SetProperty ("/:leave_trans_duration", 0.2);
	CacheSound("sfx/tutorial.ogg");
end;

function OnKeyDown (key)
	Print("Any Key Down\n");
	-- any key speeds up leaving this screen
	if (timer > 1.0) then
		PopScreen ();
	end;

end;

function OnEnter ()
    PlaySound("sfx/tutorial.ogg");
end;

function OnLeave ()

end;

function Reset ()
   timer = 0

end;

function OnClick (name)

	Print ("OnClick " .. name .. "\n");
		
	if (name == "Continue") then			
		PopScreen ();
		return;
	end;
	
	if (name == "ok") then			
		PopScreen ();
		return;
	end;
	

	if (name == "Menu") then
		PushScreen ("GamePopMenu");
		return;
	end;	
	
	return 1;
end;


function OnUpdate (tdelta)

	timer = timer + tdelta;    
	
	local offset = 10 * (1 + math.cos (timer*6));
	SetProperty ("ice_arrow:position_offset.x", offset);
	SetProperty ("blue_arrow:position_offset.x", offset);
	SetProperty ("joker_arrow:position_offset.x", offset);
	SetProperty ("powerup_arrow:position_offset.x", offset);
	
		
	particletimer = particletimer+tdelta
	
	akey = GetActiveScreenAnimKey ();	
	alpha = GetActiveScreenTransPhase();
	SetProperty ("panel:alpha", alpha);
	SetProperty ("panel:position_offset.y", (1-alpha)*100);
	
	if(GetProperty("ok:visible") == 1 and particletimer > 0.3) then
		--SpawnFX ("fxs/smallbutton_particle_emit.lua", GetProperty("ok:static_position.x"), GetProperty("ok:static_position.y"), 180, 0);	
		particletimer = 0
	end;
		

    
end;

function OnDraw ()

end;
