local ax = SCREEN_WIDTH/640;
local ay = SCREEN_HEIGHT/480;

if GAMESTATE:IsHumanPlayer(PLAYER_1) then
	stepsr = (GAMESTATE:GetCurrentSteps(PLAYER_1):GetDifficulty())
	if stepsr == "Difficulty_Beginner" then stepsr = 0 end
	if stepsr == "Difficulty_Easy" then stepsr = 1 end
	if stepsr == "Difficulty_Medium" then stepsr = 2 end
	if stepsr == "Difficulty_Hard" then stepsr = 3 end
	if stepsr == "Difficulty_Challenge" then stepsr = 4 end
else
	stepsr = 0
end

if GAMESTATE:IsHumanPlayer(PLAYER_2) then
	stepsr2 = (GAMESTATE:GetCurrentSteps(PLAYER_2):GetDifficulty())
	if stepsr2 == "Difficulty_Beginner" then stepsr2 = 0 end
	if stepsr2 == "Difficulty_Easy" then stepsr2 = 1 end
	if stepsr2 == "Difficulty_Medium" then stepsr2 = 2 end
	if stepsr2 == "Difficulty_Hard" then stepsr2 = 3 end
	if stepsr2 == "Difficulty_Challenge" then stepsr2 = 4 end
else
	stepsr2 = 0
end

steps1 = stepsr
steps2 = stepsr2

local t = Def.ActorFrame{}
local dir = {{},{}}
local cx = {{},{}}
local cy = {{},{}}
local dir2 = {{},{}}
local cx2 = {{},{}}
local cy2 = {{},{}}
local thack = {0,0};

if steps1 == 2 then thack[1] = 0.408; end
if steps2 == 2 then thack[2] = 0.408; end

--death

function OtomeStepAt(pn, i, set)
	if set == 1 then
	if pn == 1 then
		if steps1 == 3 and i ~= 7 and i ~= 15 and i~= 23 and i<29 then return true end
		if steps1 == 2 and i ~= 7 and i ~= 15 and i~= 23 and i<30 and i%2 == 1 then return true end
		if steps1 == 1 and i ~= 7 and i ~= 15 and i~= 23 and i<29 and i%4 == 0 then return true end
	end
	if pn == 2 then
		if steps2 == 3 and i ~= 7 and i ~= 15 and i~= 23 and i<29 then return true end
		if steps2 == 2 and i ~= 7 and i ~= 15 and i~= 23 and i<30 and i%2 == 1 then return true end
		if steps2 == 1 and i ~= 7 and i ~= 15 and i~= 23 and i<29 and i%4 == 0 then return true end
	end
	else
	if pn == 1 then
		if steps1 == 3 and i ~= 7 and i ~= 15 and i~= 23 and i<29 and i%2 == 1 then return true end
		if steps1 == 2 and i ~= 7 and i ~= 15 and i~= 23 and i<30 and i%2 == 1 then return true end
	end
	if pn == 2 then
		if steps2 == 3 and i ~= 7 and i ~= 15 and i~= 23 and i<29 and i%2 == 1 then return true end
		if steps2 == 2 and i ~= 7 and i ~= 15 and i~= 23 and i<30 and i%2 == 1 then return true end
	end
	end
	return false;
end

--hahaha fuck jumps
for a = 1, 33, 1 do
	dir[1][#dir+1] = "";
	cx[1][#cx+1] = 0;
	cy[1][#cy+1] = 0;
	dir[2][#dir+1] = "";
	cx[2][#cx+1] = 0;
	cy[2][#cy+1] = 0;
	dir2[1][#dir+1] = "";
	cx2[1][#cx+1] = 0;
	cy2[1][#cy+1] = 0;
	dir2[2][#dir+1] = "";
	cx2[2][#cx+1] = 0;
	cy2[2][#cy+1] = 0;
end

for n = 1, 2, 1 do
for i = 0, 31, 1 do
	
	--FUCK THIS GAY EARTH
	--behold, some of the ugliest lua this side of a dog's ass
	if steps1 == 3 and n == 1 or steps2 == 3 and n == 2 or steps1 == 2 and n == 1 or steps2 == 2 and n == 2 then
	if i<32 and i>=24 then
	if i==29 and steps1 == 2 and n == 1 or i==29 and steps2 == 2 and n == 2 then
		cx2[n][i+1] = 190+((n-1)*320);
		dir2[n][i+1] = "up"
	else
		cx2[n][i+1] = 220+((n-1)*320);
		dir2[n][i+1] = "right";
	end
	if i==29 and steps1 == 2 and n == 1 or i==29 and steps2 == 2 and n == 2 then cx[n][i+1] = 125+((n-1)*320);
	elseif i==28 then cx[n][i+1] = 150+((n-1)*320);
	elseif i==27 then cx[n][i+1] = 70+((n-1)*320); else
	cx[n][i+1] = 130+(((i+1)%2)*80)+((n-1)*320); end
	cy[n][i+1] = 290-((i%8)*40);
	cy2[n][i+1] = 290-((i%8)*40);
	elseif i<24 and i>=16 then
	if i==19 then cx2[n][i+1] = 130+((n-1)*320)-40; else
	cx2[n][i+1] = 170+((n-1)*320)-40; end
	dir2[n][i+1] = "left"
	if i==19 then cx[n][i+1] = 190+((i%2)*80)+((n-1)*320)-40; else
	cx[n][i+1] = 160+((i%2)*80)+((n-1)*320)-40; end
	cy[n][i+1] = 170+((i%8)*40);
	cy2[n][i+1] = 170+((i%8)*40);
	elseif i<16 and i>=8 then
	dir2[n][i+1] = "right"
	cx2[n][i+1] = 220+((n-1)*320);
	cx[n][i+1] = 130+(((i+1)%2)*80)+((n-1)*320);
	cy[n][i+1] = 340-((i%8)*40);
	cy2[n][i+1] = 340-((i%8)*40);
	elseif i<8 then
	cx2[n][i+1] = 110+((n-1)*320);
	dir2[n][i+1] = "left"
	cx[n][i+1] = 100+((i%2)*90)+((n-1)*320);
	cy[n][i+1] = 150+((i%8)*40);
	cy2[n][i+1] = 150+((i%8)*40);
	end
	--oh look, a table
	dir[1]={"left","down","left","down","left","down","left","",
	"right","down","right","down","right","down","right","",
	"left","up","left","right","left","up","left","",
	"right","up","right","left","up","down","",""
	}
	dir[2]=dir[1]
	end
	
	--at least this stays the same
	if steps1 == 1 and n == 1 or steps2 == 1 and n == 2 then
	if i<32 and i>=24 then dir[n][i+1] = "down"; cx[n][i+1] = 130+((i%2)*20)+((n-1)*320); cy[n][i+1] = 250-((i%8)*40);
	elseif i<24 and i>=16 then dir[n][i+1] = "right"; cx[n][i+1] = 160+((i%2)*20)+((n-1)*320); cy[n][i+1] = 170+((i%8)*40);
	elseif i<16 and i>=8 then dir[n][i+1] = "up"; cx[n][i+1] = 130+((i%2)*20)+((n-1)*320); cy[n][i+1] = 340-((i%8)*40);
	elseif i<8 then dir[n][i+1] = "left"; cx[n][i+1] = 100+((i%2)*20)+((n-1)*320); cy[n][i+1] = 150+((i%8)*40); end
	end
	
	if n == 1 and GAMESTATE:IsHumanPlayer(PLAYER_1) or n == 2 and GAMESTATE:IsHumanPlayer(PLAYER_2) then
	if OtomeStepAt(n, i, 1) then
	
		t[#t+1] = LoadActor("../graphics/"..dir[n][i+1]..".png")..{
			OnCommand=cmd(zoom,0;sleep,i*0.408+0.000-thack[n];x,cx[n][i+1];y,cy[n][i+1];linear,0.816;zoom,1;linear,0.1;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
		t[#t+1] = LoadActor("../graphics/marker.png")..{
			OnCommand=cmd(zoom,2;diffusealpha,0;sleep,i*0.408+0.000-thack[n];x,cx[n][i+1];y,cy[n][i+1];linear,0.816;zoom,1;diffusealpha,1;linear,0.1;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
		t[#t+1] = LoadActor("../graphics/ring.png")..{
			OnCommand=cmd(diffusealpha,0;sleep,i*0.408+0.000-thack[n];x,cx[n][i+1];y,cy[n][i+1];linear,0.1;diffusealpha,1;sleep,0.716;linear,0.1;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
		t[#t+1] = LoadActor("../graphics/hit.png")..{
			OnCommand=cmd(zoom,0;sleep,i*0.408+0.816+0.000-thack[n];x,cx[n][i+1];y,cy[n][i+1];zoom,1;linear,0.5;zoom,0.7;rotationz,45;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
	
	end
	if OtomeStepAt(n, i, 2) then
	
		t[#t+1] = LoadActor("../graphics/"..dir2[n][i+1]..".png")..{
			OnCommand=cmd(zoom,0;sleep,i*0.408+0.000-thack[n];x,cx2[n][i+1];y,cy2[n][i+1];linear,0.816;zoom,1;linear,0.1;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
		t[#t+1] = LoadActor("../graphics/marker.png")..{
			OnCommand=cmd(zoom,2;diffusealpha,0;sleep,i*0.408+0.000-thack[n];x,cx2[n][i+1];y,cy2[n][i+1];linear,0.816;zoom,1;diffusealpha,1;linear,0.1;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
		t[#t+1] = LoadActor("../graphics/ring.png")..{
			OnCommand=cmd(diffusealpha,0;sleep,i*0.408+0.000-thack[n];x,cx2[n][i+1];y,cy2[n][i+1];linear,0.1;diffusealpha,1;sleep,0.716;linear,0.1;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
		t[#t+1] = LoadActor("../graphics/hit.png")..{
			OnCommand=cmd(zoom,0;sleep,i*0.408+0.816+0.000-thack[n];x,cx2[n][i+1];y,cy2[n][i+1];zoom,1;linear,0.5;zoom,0.7;rotationz,45;diffusealpha,0;queuecommand,"Stop");
			StopCommand=cmd(stoptweening;);
		}
	
	end
	end

end
end

return t;