-- Main Menu

function PlayClick (x, y)
	--LoadLevel("zerolevel.xml");
	SetNextLevel("test01.xml");
	EndLevel();
end

function OnOver (go)
  s = GetSpriteComp(go);
  PlaySound("MenuClick");
  SpriteComp_Color(s, Vec4(255, 0, 255, 255));
end

function OnExit (go)
  s = GetSpriteComp(go);
  SpriteComp_Color(s, Vec4(255, 255, 255, 255));
end

function PlayButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "Play", .5);
	SetPause(false);
end

function OptionsClick(x, y)
	LoadLevel("Options.xml");
end

function OptionsButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "Options", .5);
end

function CreditsClick(x, y)
	SetNextLevel("Credits.xml");
	EndLevel();
end

function CreditsButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "Credits", .5);
end

function ExitClick(x, y)
	MMtoggleQuitConfirm();
end

function ExitButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "Exit", .5);
end

function HowToPlayClick(x, y)
	LoadLevel("HowToPlay.xml");
end

function HowToPlayButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "How To\nPlay", .5);
end

function MMquitConfirm(name, inst)
	x, y, z = GOGetPos(name, inst);
	SetFontColor("umopmed", 255, 255, 255, 255);
	ScreenText("umopmed", x, y, "Are you sure you\n want to quit?", .5);
end

function MMtoggleQuitConfirmp(x, y)
	MMtoggleQuitConfirm();
end

function MMtoggleQuitConfirm()
	a = GOGetActive("MMQuit", 0);
	GOActive("MMQuit", 0, not a);
	GOActive("MMQuitYes", 0, not a);
	GOActive("MMQuitNo", 0, not a);
end

function TextYes(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "Yes", .5);
end

function TextNo(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "No", .5);
end


--Splash Screen
function SplashHandler ()
	SetNextLevel("MainMenu.xml");
	EndLevel();
end

function DigiSplash ()
	CreateKeyboardAction(VK_SPACE, "SkipMenu");
  CreateMouseAction(MOUSE_LEFT, "SkipMenu");
	CreateMouseAction(MOUSE_RIGHT, "SkipMenu");
	CreateKeyboardAction(VK_ESCAPE, "SkipMenu");
	CreateKeyboardAction(VK_RETURN, "SkipMenu");
	RegisterForInput("SkipMenu", "SplashHandler", ACTION_TRIGGER);
	SendDelayedLuaMessage("EndLevel();", 4.0);
end

function DigiSplashExit()
		UnregisterForInput("SkipMenu", ACTION_TRIGGER);
end

--Credits

function CreditsOnEnter ()
	StopSound("Wind_Low");
	StopSound("StringLine");
	CreateKeyboardAction(VK_SPACE, "SkipMenu");
	RegisterForInput("SkipMenu", "SplashHandler", ACTION_TRIGGER);
	SendDelayedLuaMessage("EndLevel();", 20.0);
end

function CreditsOnExit()
		UnregisterForInput("SkipMenu", ACTION_TRIGGER);
end

dofile "Resources\\lua\\creditsList.lua";

function LetterBoxPos(name, inst)
	w, h = GetCurrentResolution();
	Lw, Lh = GetLetterBoxedResolution();
	if w ~= Lw then
		GOPosition(name, inst, 960 + (w - Lw) / (Lw * 2) * 960, 0, -0.09);
		GOScale(name, inst, (w - Lw) / Lw * 960, 1200, 1);
	elseif h ~= Lh then
		GOPosition(name, inst, 0, 600 + (h - Lh) / (Lh * 2) * 600, -0.09);
		GOScale(name, inst, 1920, (h - Lh) / Lh * 600, 1);
	else
		GOActive(name, inst, false);
	end
end

function LetterBoxNeg(name, inst)
	w, h = GetCurrentResolution();
	Lw, Lh = GetLetterBoxedResolution();
	if w ~= Lw then
		GOPosition(name, inst, -(960 + (w - Lw) / (Lw * 2) * 960), 0, -0.09);
		GOScale(name, inst, (w - Lw) / Lw * 960, 1200, 1);
	elseif h ~= Lh then
		GOPosition(name, inst, 0, -(600 + (h - Lh) / (Lh * 2) * 600), -0.09);
		GOScale(name, inst, 1920, (h - Lh) / Lh * 600, 1);
	else
		GOActive(name, inst, false);
	end
end

--Options Menu

function OptFullScreen(name, inst)
	x, y, z = GOGetPos(name, inst);
	SetFontColor("umopmed", 255, 255, 255, 255);
	ScreenText("umopmed", x+40, y + 50, "Full Screen", .5);
end

function BGM(name, inst)
	x, y, z = GOGetPos(name, inst);
	SetFontColor("umopmed", 255, 255, 255, 255);
	ScreenText("umopmed", x, y + 50, "Music", .5);
end

function SoundFX(name, inst)
	x, y, z = GOGetPos(name, inst);
	SetFontColor("umopmed", 255, 255, 255, 255);
	ScreenText("umopmed", x, y + 50, "Sounds", .5);
end

function ScreenSize(name, inst)
	x, y, z = GOGetPos(name, inst);
	SetFontColor("umopmed", 255, 255, 255, 255);
	ScreenText("umopmed", x+50, y + 50, "Screen Size", .5);
end

function BackButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y + 50, "Back", .5);
end

function BackClick(x, y)
	SetNextLevel("");
	EndLevel();
end

function OptFSoffButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "Off", .5);
end

function OptFSoffClick(x, y)
	FullScreen(false);
end

function OptFSonButton(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x, y, "On", .5);
end

function OptFSonClick(x, y)
	FullScreen(true);
end

function SSboxClick(x, y)
	--Ypos = -37;   --hard coded from xml
	--size = 535 / 10;
	--num = GetNumResolutions();
	--index = (Ypos - y) / size;
	--if index < size and index >= 0 then
	--	GoToResolutionAtIndex(index);
	--end
end

function FillSSbox(name, inst)
	--x, y, z = GOGetPos(name, inst);
	--size = 535 / 10
	--num = GetNumResolutions();
	--for i = 0, num-1 do
	--	w, h = GetResolutionAtIndex(i);
	--	w = string.format("%i X %i", w, h);
	--  SetFontColor("umopmed", 255, 255, 255, 255);
	--	ScreenText("umopmed", x, y + 267.5 - i * size, w, .35);
	--end
end

function ResClick(index)
  num = GetNumResolutions();
	if index < num and index >= 0 then
		GoToResolutionAtIndex(index);
	end
end

function ResDisplay(name, inst, index)
  num = GetNumResolutions();
  if index < num and index >= 0 then
	  w, h = GetResolutionAtIndex(index);
	  w = string.format("%i X %i", w, h);
	  x, y, z = GOGetPos(name, inst);
    go = GetGOPointer(name, inst);
    s = GetSpriteComp(go);
    r, g, b, a = SpriteComp_GetColor(s);
	  SetFontColor("umopmed", r, g, b, a);
		ScreenText("umopmed", x, y, w, .35);
	end
end

function CurResDisplay(name, inst)
	w, h = GetCurrentResolution();
  w = string.format("%i X %i", w, h);
	x, y, z = GOGetPos(name, inst);
	SetFontColor("umopmed", 0, 0, 0, 255);
	ScreenText("umopmed", x, y, w, .5);
end

function Res0Click(x, y)
  ResClick(0);
end

function Res0Display(name, inst)
  ResDisplay(name, inst, 0);
end

function Res1Click(x, y)
  ResClick(1);
end

function Res1Display(name, inst)
  ResDisplay(name, inst, 1);
end

function Res2Click(x, y)
  ResClick(2);
end

function Res2Display(name, inst)
  ResDisplay(name, inst, 2);
end

function Res3Click(x, y)
  ResClick(3);
end

function Res3Display(name, inst)
  ResDisplay(name, inst, 3);
end

function Res4Click(x, y)
  ResClick(4);
end

function Res4Display(name, inst)
  ResDisplay(name, inst, 4);
end

function Res5Click(x, y)
  ResClick(5);
end

function Res5Display(name, inst)
  ResDisplay(name, inst, 5);
end

function Res6Click(x, y)
  ResClick(6);
end

function Res6Display(name, inst)
  ResDisplay(name, inst, 6);
end

function Res7Click(x, y)
  ResClick(7);
end

function Res7Display(name, inst)
  ResDisplay(name, inst, 7);
end

function Res8Click(x, y)
  ResClick(8);
end

function Res8Display(name, inst)
  ResDisplay(name, inst, 8);
end

function Res9Click(x, y)
  ResClick(9);
end

function Res9Display(name, inst)
  ResDisplay(name, inst, 9);
end

function BGMvolume10(x, y)
	SetBGMVolume(1.0);
end

function BGMvolume0(x, y)
	SetBGMVolume(0.0);
end

function BGMvolume1(x, y)
	SetBGMVolume(0.1);
end

function BGMvolume2(x, y)
	SetBGMVolume(0.2);
end

function BGMvolume3(x, y)
	SetBGMVolume(0.3);
end

function BGMvolume4(x, y)
	SetBGMVolume(0.4);
end

function BGMvolume5(x, y)
	SetBGMVolume(0.5);
end

function BGMvolume6(x, y)
	SetBGMVolume(0.6);
end

function BGMvolume7(x, y)
	SetBGMVolume(0.7);
end

function BGMvolume8(x, y)
	SetBGMVolume(0.8);
end

function BGMvolume9(x, y)
	SetBGMVolume(0.9);
end

function SFXvolume10(x, y)
	SetSFXVolume(1.0);
end

function SFXvolume0(x, y)
	SetSFXVolume(0.0);
end

function SFXvolume1(x, y)
	SetSFXVolume(0.1);
end

function SFXvolume2(x, y)
	SetSFXVolume(0.2);
end

function SFXvolume3(x, y)
	SetSFXVolume(0.3);
end

function SFXvolume4(x, y)
	SetSFXVolume(0.4);
end

function SFXvolume5(x, y)
	SetSFXVolume(0.5);
end

function SFXvolume6(x, y)
	SetSFXVolume(0.6);
end

function SFXvolume7(x, y)
	SetSFXVolume(0.7);
end

function SFXvolume8(x, y)
	SetSFXVolume(0.8);
end

function SFXvolume9(x, y)
	SetSFXVolume(0.9);
end

function SFXselect(name, inst)
	x, y, z = GOGetPos(name, inst);
	level = GetSFXVolume() * 10;
	GOPosition(name, inst, 380 + level * 40, y, z);
end

function BGMselect(name, inst)
	x, y, z = GOGetPos(name, inst);
	level = GetBGMVolume() * 10;
	GOPosition(name, inst, 380 + level * 40, y, z);
end

function BGMvolumeUp(name, inst)
	PlaySound("MenuClick");
	cur = GetBGMVolume();
	SetBGMVolume(cur + 0.1);
end

function BGMvolumeDown(name, inst)
	PlaySound("MenuClick");
	cur = GetBGMVolume();
	SetBGMVolume(cur - 0.1);
end

function SFXvolumeUp(name, inst)
	PlaySound("MenuClick");
	cur = GetSFXVolume();
	SetSFXVolume(cur + 0.1);
end

function SFXvolumeDown(name, inst)
	PlaySound("MenuClick");
	cur = GetSFXVolume();
	SetSFXVolume(cur - 0.1);
end

function SoundPlus(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x + 20, y + 15, "+", .75);
end

function SoundMinus(name, inst)
	x, y, z = GOGetPos(name, inst);
  go = GetGOPointer(name, inst);
  s = GetSpriteComp(go);
  r, g, b, a = SpriteComp_GetColor(s);
	SetFontColor("umopmed", r, g, b, a);
	ScreenText("umopmed", x + 20, y + 15, "-", .75);
end

function BrianLevelStart()
  TestLevel();
  LoadPauseMenu();
  AddCameraLock(10, -3, 14, 1, -12);
  AddCameraFollow(17, -3);
end

function test01Start()
  TestLevel();
  LoadPauseMenu();
  go = GetGOPointer("Move_Tile", 0);
  p = GetPhysicsComp(go);
  PhysicsComp_AddDestination(p, -2, -5, 5)
  PhysicsComp_AddDestination(p, -6, -5, 5)	-- Move_Tile0
  go = GetGOPointer("Move_Tile", 1);
  p = GetPhysicsComp(go);
  PhysicsComp_AddDestination(p, 6, -5, 5)	
  PhysicsComp_AddDestination(p, 12, -3, 5)	-- Move_Tile1
  go = GetGOPointer("Move_Tile", 2);
  p = GetPhysicsComp(go);
  PhysicsComp_AddDestination(p, 16, 1, 5)
  PhysicsComp_AddDestination(p, 16, -3, 5)	-- Move_Tile2
  go = GetGOPointer("Move_Tile", 3);
  p = GetPhysicsComp(go);
  PhysicsComp_AddDestination(p, 20, 2, 5)
  PhysicsComp_AddDestination(p, 20, 6, 5)	-- Move_Tile3
end

function LevelStart()
	CameraFollow("Player", 0);
	GORotUp("Player", 0, -90);
	SetPrevPause(false);
	LoadPauseMenu();
	RegisterForInput("PlayerJump", "PlayerJump", ACTION_TRIGGER);
	RegisterForInput("PlayerLeft", "PlayerLeft", ACTION_PRESS);
	RegisterForInput("PlayerRight", "PlayerRight", ACTION_PRESS);
	RegisterForInput("PlayerLeft", "PlayerStopLeft", ACTION_RELEASE);
	RegisterForInput("PlayerRight", "PlayerStopRight", ACTION_RELEASE);
	--RegisterForInput("PlayerLeft", "StartTime", ACTION_TRIGGER);
	--RegisterForInput("PlayerRight", "StartTime", ACTION_TRIGGER);
	RegisterForInput("RestartToCheckPoint", "RestartToCheckPoint", ACTION_TRIGGER);
	RegisterForInput("ToggleTime", "ToggleTime", ACTION_TRIGGER);
end

function TestLevel()
	LoadPauseMenu();
	CameraFollow("Player", 0);
	RegisterForInput("PlayerJump", "PlayerJump", ACTION_TRIGGER);
	RegisterForInput("PlayerLeft", "PlayerLeft", ACTION_PRESS);
	RegisterForInput("PlayerRight", "PlayerRight", ACTION_PRESS);
	RegisterForInput("PlayerLeft", "PlayerStopLeft", ACTION_RELEASE);
	RegisterForInput("PlayerRight", "PlayerStopRight", ACTION_RELEASE);
	RegisterForInput("PlayerLeft", "StartTime", ACTION_TRIGGER);
	RegisterForInput("PlayerRight", "StartTime", ACTION_TRIGGER);	
	RegisterForInput("StartTime", "StartTime", ACTION_TRIGGER);
	RegisterForInput("RestartToCheckPoint", "RestartToCheckPoint", ACTION_TRIGGER);
	--RegisterForInput("ToggleTime", "ToggleTime", ACTION_TRIGGER);
	T = GetTileModule();
	TileModule_SetJumpStrength(T, 2, 6.3);	-- Set BounceBlock velocoties
  SetPrevPause(false);
  LoadPauseMenu();
end

function LevelEnd()
	CameraUnfollow();
	UnloadPauseMenu();
	UnregisterForInput("PlayerJump", ACTION_TRIGGER);
	UnregisterForInput("PlayerLeft", ACTION_PRESS);
	UnregisterForInput("PlayerRight", ACTION_PRESS);
	UnregisterForInput("PlayerLeft", ACTION_RELEASE);
	UnregisterForInput("PlayerRight", ACTION_RELEASE);
	UnregisterForInput("RestartToCheckPoint", ACTION_TRIGGER);
	UnregisterForInput("ToggleTime", ACTION_TRIGGER);
end

function ZeroLevelStart()
	LevelStart();
	AddCameraLock(30, 2, 35, 7, -11);
	AddCameraLock(30, 5, 35, 7, -11);
	AddCameraFollow(28, 1);
	AddCameraFollow(28, 4);
	SetCurTextVars("umopmed", .50, 255, 50, 50);
	AddTextOnPlayerPos(22, 3, 0, 200, "Touch Red Flowers to stop time", 4.0);
	AddTextOnPlayerPos(32, 2, 0, 200, "When time is stopped, move blocks\n with the mouse and Left Click", 7.0);
end

function SecondLevelStart()
	LevelStart();
	AddCameraLock(0, 0, 2, 8, -12);
end

function FirstLevelStart()
	LevelStart();
	AddCameraLock(8, 0, 16, 4, -15);
	AddCameraLock(14, -1, 16, 4, -15);
	AddCameraLock(13, -7, 14, -6, -13);
	AddCameraLock(17, -9, 14, -6, -13);
	AddCameraFollow(6, 0);
	AddCameraFollow(14, -3);
	AddCameraFollow(13, -5);
	AddCameraFollow(19, -9);
end

function LevelScript_test01()
	LevelStart();
	SetCurTextVars("umopmed", 1.25, 255, 255, 255);
	AddTextOnPlayerPos(0, 0, 0, 500, "Experiment 01", 5.0); -- (player x, player y, screen x, screen y, text, duration);
end

function LevelScript_test02()
	LevelStart();
	SetCurTextVars("umopmed", 1.25, 255, 255, 255);
	AddTextOnPlayerPos(0, 0, 0, 500, "Experiment 02", 5.0); -- (player x, player y, screen x, screen y, text, duration);
end

function LevelScript_test03()
	LevelStart();
	SetCurTextVars("umopmed", 1.25, 255, 255, 255);
	AddTextOnPlayerPos(-1, 0, 0, 500, "Experiment 03", 5.0); -- (player x, player y, screen x, screen y, text, duration);
end

function LevelScript_test04()
	LevelStart();
end

function LevelScript_test12()
	LevelStart();
	SetCurTextVars("umopmed", 1.25, 255, 255, 255);
	AddTextOnPlayerPos(0, 0, 0, 500, "Experiment 12", 5.0); -- (player x, player y, screen x, screen y, text, duration);
end

function LevelScript_test04()
	LevelStart();
	SetCurTextVars("umopmed", 1, 255, 255, 255);
	AddTextOnPlayerPos(-7, -4, 0, 500, "LEVEL 04", 5.0); -- (player x, player y, screen x, screen y, text, duration)
	
	go = GetGOPointer("Move_Tile", 0);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, -2, -5, 5)
	PhysicsComp_AddDestination(p, -6, -5, 5)	-- Move_Tile0
	go = GetGOPointer("Move_Tile", 1);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 6, -5, 5)	
	PhysicsComp_AddDestination(p, 12, -3, 5)	-- Move_Tile1
	go = GetGOPointer("Move_Tile", 2);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 16, 1, 5)
	PhysicsComp_AddDestination(p, 16, -3, 5)	-- Move_Tile2
	go = GetGOPointer("Move_Tile", 3);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 20, 2, 5)
	PhysicsComp_AddDestination(p, 20, 6, 5)	-- Move_Tile3
end

function LevelScript_test05()
	LevelStart();
	SetCurTextVars("umopmed", 1, 255, 255, 255);
	AddTextOnPlayerPos(-7, -4, 0, 500, "LEVEL 5", 5.0); -- (player x, player y, screen x, screen y, text, duration)
	
	go = GetGOPointer("Move_Tile", 0);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, -2, -5, 5)
	PhysicsComp_AddDestination(p, -6, -5, 5)	-- Move_Tile0
	
	go = GetGOPointer("Move_Tile", 1);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 6, -5, 5)	
	PhysicsComp_AddDestination(p, 12, -3, 5)	-- Move_Tile1
	
	go = GetGOPointer("Move_Tile", 2);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 16, 1, 5)
	PhysicsComp_AddDestination(p, 16, -3, 5)	-- Move_Tile2
	
	go = GetGOPointer("Move_Tile", 3);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 20, 2, 5)
	PhysicsComp_AddDestination(p, 20, 6, 5)	-- Move_Tile3
	
	go = GetGOPointer("Move_Tile", 4);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 8, 12, 6) -- Move_Tile4 END position
	PhysicsComp_AddDestination(p, 8, 12, 3) -- pause
	PhysicsComp_AddDestination(p, 8, 19, 6) -- above ceiling
	PhysicsComp_AddDestination(p, -14, 23, 0.5) -- race around
	PhysicsComp_AddDestination(p, -14, 2, 0.5) -- race around2
	PhysicsComp_AddDestination(p, 8, 2, 0.5) -- race around3
	PhysicsComp_AddDestination(p, 8, 8, 5)	-- Move_Tile4 start position
	
	go = GetGOPointer("Move_Tile", 5);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 7, 12, 6) -- Move_Tile5 END position
	PhysicsComp_AddDestination(p, 7, 12, 3) -- pause
	PhysicsComp_AddDestination(p, 7, 19, 6) -- above ceiling
	PhysicsComp_AddDestination(p, -14, 23, 0.5) -- race around
	PhysicsComp_AddDestination(p, -14, 2, 0.5) -- race around2
	PhysicsComp_AddDestination(p, 7, 2, 0.5) -- race around3
	PhysicsComp_AddDestination(p, 7, 8, 5)	-- Move_Tile5 start position
	
	go = GetGOPointer("Move_Tile", 6);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, -4, 13, 4)
	PhysicsComp_AddDestination(p, 0, 13, 4)	-- Move_Tile6
end

function LevelScript_test06()
	LevelStart();
	SetCurTextVars("umopmed", 1, 255, 255, 255);
	AddTextOnPlayerPos(-7, -4, 0, 500, "THE SANDBOX", 5.0); -- (player x, player y, screen x, screen y, text, duration)
	
	go = GetGOPointer("Move_Tile", 0);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 12, 41, 10)
	PhysicsComp_AddDestination(p, 14, 41, 1)
	PhysicsComp_AddDestination(p, 14, -10, 1)
	PhysicsComp_AddDestination(p, 12, -10, 1)	-- Move_Tile0
	
	go = GetGOPointer("Move_Tile", 1);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, -26, 41, 10)
	PhysicsComp_AddDestination(p, -28, 41, 1)
	PhysicsComp_AddDestination(p, -28, -10, 1)
	PhysicsComp_AddDestination(p, -26, -10, 1)	-- Move_Tile1
end

function LevelScript_test07()
	LevelStart();
	SetCurTextVars("umopmed", 1, 255, 255, 255);
	AddTextOnPlayerPos(0, 0, 0, 500, "THE CLIMB", 5.0); -- (player x, player y, screen x, screen y, text, duration)
	
	go = GetGOPointer("Move_Tile", 0);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 26, 7, 3)
	PhysicsComp_AddDestination(p, 26, 7, .4)
	PhysicsComp_AddDestination(p, 32, 4, 3)
	PhysicsComp_AddDestination(p, 32, 4, .4)
	PhysicsComp_AddDestination(p, 26, 0, 3)
	PhysicsComp_AddDestination(p, 26, 0, .4)
	PhysicsComp_AddDestination(p, 20, 4, 3)
	PhysicsComp_AddDestination(p, 20, 4, .4)	-- Move_Tile0
	
	go = GetGOPointer("Move_Tile", 1);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 27, 7, 3)
	PhysicsComp_AddDestination(p, 27, 7, .4)
	PhysicsComp_AddDestination(p, 33, 4, 3)
	PhysicsComp_AddDestination(p, 33, 4, .4)
	PhysicsComp_AddDestination(p, 27, 0, 3)
	PhysicsComp_AddDestination(p, 27, 0, .4)
	PhysicsComp_AddDestination(p, 21, 4, 3)
	PhysicsComp_AddDestination(p, 21, 4, .4)	-- Move_Tile1
	
	go = GetGOPointer("Move_Tile", 2);
	p = GetPhysicsComp(go);
	PhysicsComp_AddDestination(p, 28, 7, 3)
	PhysicsComp_AddDestination(p, 28, 7, .4)
	PhysicsComp_AddDestination(p, 34, 4, 3)
	PhysicsComp_AddDestination(p, 34, 4, .4)
	PhysicsComp_AddDestination(p, 28, 0, 3)
	PhysicsComp_AddDestination(p, 28, 0, .4)
	PhysicsComp_AddDestination(p, 22, 4, 3)
	PhysicsComp_AddDestination(p, 22, 4, .4)	-- Move_Tile2
end

function LevelScript_test08()
	LevelStart();
	SetCurTextVars("umopmed", 1, 255, 255, 255);
	AddTextOnPlayerPos(0, 0, 0, 500, "THE RHYTHM", 5.0); -- (player x, player y, screen x, screen y, text, duration)
end

function LevelScript_acceleratortest()
	LevelStart();
	
	go = GetGOPointer("Accelerator", 0);
	a = GetAcceleratorComp(go);
	AcceleratorComp_SetParam(a, Vec2(-1, 1), 1, Vec2(2, 2), Vec2(5, 5));
end

function UpdateScore(name, inst)
		currScore = GetCurrScore();
		totalScore = GetTotalScore();
		text = string.format("Score: %d / %d", currScore, totalScore );
		SetFontColor("umopmed", 255, 255, 255, 255);
		ScreenText("umopmed", -600, 550, text, .5);
end