<ActorFrame
InitCommand="%function(self)

	self:fov(50);

	songName = GAMESTATE:GetCurrentSong():GetSongDir();
	
	baby_bulletindexP1 = 1;
	baby_bulletindexP2 = 1;
	for p=1,4 do
		_G['baby_bulletindex'..p] = 1
	end
	
	if uksrt5_stage2done == nil then
		uksrt5_stage2done = 0;
	else
		uksrt5_stage2done = uksrt5_stage2done+2;
	end
	
	if uksrt5_stage2done>16 then
		uksrt5_stage2done = 0;
	end
	
	_G['baby_shape'..(uksrt5_stage2done+1)] = {};
	_G['baby_shape'..(uksrt5_stage2done+2)] = {};
	
	noteskin_dimer = false;
	for i=0, 3 do
		_G['receptor_rotationx_'..i] = 0;
		_G['receptor_rotationy_'..i] = 0;
		_G['receptor_rotationz_'..i] = 0;
		_G['receptor_x_'..i] = 0;
		_G['receptor_y_'..i] = 0;
		_G['receptor_z_'..i] = 0;
		_G['receptor_zoom_'..i] = 1;
		_G['receptor_zoomx_'..i] = 1;
		_G['receptor_zoomy_'..i] = 1;
		_G['receptor_zoomtowidth_'..i] = nil;
		_G['receptor_zoomtoheight_'..i] = nil;
		_G['receptor_tint_'..i] = nil;
		_G['receptor_fade_'..i] = nil;
		_G['receptor_effect_'..i] = '';
		_G['receptor_effectset_'..i] = false;
		_G['receptor_effectcontrol_'..i] = {0,0,0,0,'timer'};
		-------
		_G['noteskin_rotationx_'..i] = 0;
		_G['noteskin_rotationy_'..i] = 0;
		_G['noteskin_rotationz_'..i] = 0;
		_G['noteskin_x_'..i] = 0;
		_G['noteskin_y_'..i] = 0;
		_G['noteskin_z_'..i] = 0;
		_G['noteskin_zoom_'..i] = 1;
		_G['noteskin_zoomx_'..i] = 1;
		_G['noteskin_zoomy_'..i] = 1;
		_G['noteskin_zoomtowidth_'..i] = nil;
		_G['noteskin_zoomtoheight_'..i] = nil;
		_G['noteskin_tint_'..i] = {1,1,1,1};
		_G['noteskin_fade_'..i] = 1;
		_G['noteskin_effect_'..i] = '';
		_G['noteskin_effectset_'..i] = false;
		_G['noteskin_effectcontrol_'..i] = {0,0,0,0,'timer'};
	end
	
end"
><children>

	<Layer
		Type="Quad"
		InitCommand="hidden,1"
		OnCommand="sleep,1000"
	/>
	
	<Layer
		Type="Quad"
		InitCommand="hidden,1"
		OnCommand="%function(self)
			fgcurcommand = 1;
			fgcurcommand2 = 1;
			fgcurcommand3 = 1;
			checked = false;
			self:queuecommand('Update');
			
	baby_p1xm = 0;
	baby_p1ym = 0;
	baby_p2xm = 0;
	baby_p2ym = 0;
	baby_p1pos = {160,360};
	baby_p2pos = {160,360};
	baby_paper_xmin = 160-136;
	baby_paper_ymin = 240-136;
	baby_paper_xmax = 160+136;
	baby_paper_ymax = 240+136;
	baby_maxspd = 5;
	baby_accel = 0.2;
	baby_decel = 0.5;
	baby_drawres = 5; --how much distance per dot
	baby_drawtimerp1 = 1;
	baby_drawtimerp2 = 1;
	baby_drawing = 0;
	
	baby_visited1P1 = {};
	baby_visited2P1 = {};
	baby_visited1P2 = {};
	baby_visited2P2 = {};
	baby_visitedwrong1P1 = {};
	baby_visitedwrong2P1 = {};
	baby_visitedwrong1P2 = {};
	baby_visitedwrong2P2 = {};
	
	baby_populatepage(shape,pn)
		--[[if _G['P'..pn] and table.getn(_G['baby_shape'..shape..'P'..pn])>0 then
			local p = (((shape-1)*2)+pn)
			for i=1,table.getn(_G['baby_shape'..shape..'P'..pn]) do
				local t = baby_getnextavailablebullet(p);
				local px = _G['baby_shape'..shape..'P'..pn][i][1]
				local py = _G['baby_shape'..shape..'P'..pn][i][2]
				t[1]:rotationz(math.random(360));
				t[1]:x(px);
				t[1]:y(py);
				t[1]:hidden(0);
			end
		end]]
	end
	
	baby_shape1checkpoint = {{160,152},{264,256},{56,256},{160,360},{224,340},{80,188},{224,188},{80,340},{124,352},{196,352}}
	baby_shape1wrongpoint = {{56,360},{56,152},{264,360},{264,152},{160,256}}
	baby_shape1judge = {
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0.0078125,0.0078125,0.0078125,0.0078125,0.0078125,0.0078125,0,0,0,0,0,0,0},
		{0,0,0,0,0.0078125,0.0078125,0.015625,0.015625,0.015625,0.015625,0.015625,0.015625,0.015625,0.015625,0.0078125,0.0078125,0,0,0,0},
		{0,0,0,0.0078125,0.015625,0.03125,0.03125,0.0625,0.0625,0.0625,0.0625,0.0625,0.0625,0.03125,0.03125,0.015625,0.0078125,0,0,0},
		{0,0,0.0078125,0.015625,0.03125,0.0625,0.125,0.125,0.25,0.25,0.25,0.25,0.125,0.125,0.0625,0.03125,0.015625,0.0078125,0,0},
		{0,0.0078125,0.03125,0.0625,0.125,0.25,0.25,0.5,0.5,0.5,0.5,0.5,0.5,0.25,0.25,0.125,0.0625,0.03125,0.0078125,0},
		{0.0078125,0.015625,0.0625,0.125,0.25,0.5,1,1,1,0.5,0.5,1,1,1,0.5,0.25,0.125,0.0625,0.015625,0.0078125},
		{0.015625,0.03125,0.125,0.25,0.5,1,1,1,1,1,1,1,1,1,1,0.5,0.25,0.125,0.03125,0.015625},
		{0.03125,0.0625,0.25,0.5,1,1,1,0.5,0.25,0.25,0.25,0.25,0.5,1,1,1,0.5,0.25,0.0625,0.03125},
		{0.03125,0.125,0.25,1,1,1,0.5,0.25,0.125,0.0625,0.0625,0.125,0.25,0.5,1,1,1,0.25,0.125,0.03125},
		{0.0625,0.125,0.5,1,1,0.5,0.25,0.0625,0.03125,0.03125,0.03125,0.03125,0.0625,0.25,0.5,1,1,0.5,0.125,0.0625},
		{0.0625,0.25,0.5,1,1,0.25,0.125,0.03125,0.015625,0.0078125,0.0078125,0.015625,0.03125,0.125,0.25,1,1,0.5,0.125,0.0625},
		{0.0625,0.25,0.5,0.5,0.5,0.25,0.0625,0.03125,0.0078125,0,0,0.0078125,0.03125,0.0625,0.25,1,1,0.5,0.25,0.0625},
		{0.0625,0.25,0.5,1,1,0.25,0.0625,0.03125,0.0078125,0,0,0.0078125,0.03125,0.0625,0.25,1,1,0.5,0.25,0.0625},
		{0.0625,0.25,0.5,1,1,0.25,0.125,0.03125,0.015625,0.0078125,0.0078125,0.015625,0.03125,0.125,0.25,1,1,0.5,0.125,0.0625},
		{0.0625,0.125,0.5,1,1,0.5,0.25,0.0625,0.03125,0.03125,0.03125,0.03125,0.0625,0.25,0.5,1,1,0.5,0.125,0.0625},
		{0.03125,0.125,0.25,1,1,1,0.5,0.25,0.125,0.0625,0.0625,0.125,0.25,0.5,1,1,1,0.25,0.125,0.03125},
		{0.03125,0.0625,0.25,0.5,1,1,1,0.5,0.25,0.25,0.25,0.25,0.5,1,1,1,0.5,0.125,0.0625,0.03125},
		{0.015625,0.03125,0.125,0.25,0.5,1,1,1,1,1,1,1,1,1,1,0.5,0.25,0.125,0.03125,0.015625},
		{0.0078125,0.015625,0.0625,0.125,0.25,0.5,1,1,1,1,1,1,1,1,0.5,0.25,0.125,0.0625,0.015625,0.0078125},
		{0,0.0078125,0.03125,0.0625,0.125,0.125,0.25,0.5,0.5,0.5,0.5,0.5,0.5,0.25,0.125,0.125,0.0625,0.03125,0.0078125,0},
		{0,0,0.0078125,0.015625,0.03125,0.0625,0.125,0.125,0.125,0.25,0.25,0.125,0.125,0.125,0.0625,0.03125,0.015625,0.0078125,0,0},
		{0,0,0,0.0078125,0.015625,0.03125,0.03125,0.0625,0.0625,0.0625,0.0625,0.0625,0.0625,0.03125,0.03125,0.015625,0.0078125,0,0,0},
		{0,0,0,0,0.0078125,0.0078125,0.015625,0.015625,0.015625,0.015625,0.015625,0.015625,0.015625,0.015625,0.0078125,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0.0078125,0.0078125,0.0078125,0.0078125,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
	
	baby_shape2checkpoint = {{196.85,352.3},{253.85,277.3},{257.85,171.3},{270.85,137.3},{241.85,125.3},{233.85,165.3},
		{213.85,170.3},{186.85,220.3},{135.85,272.3},{64.85,295.3},{35.85,313.3},{45.85,343.3},
		{144.85,363.3},{99.85,360.3}}
	baby_shape2wrongpoint = {{11.85,317.3},{147.85,230.3},{169.85,200.3},{251.85,146.3},{238.85,193.3},
		{179.85,299.3},{217.85,246.3},{120.85,323.3},{100.85,323.3},{77.85,322.3},{277.85,105.3},
		{244.85,95.3},{184.85,168.3},{287.85,168.3},{280.85,264.3},{237.85,352.3},{262.85,310.3},
		{53.85,261.3},{113.85,251.3},{43.85,381.3},{123.85,392.3},{290.85,144.3},{289.85,124.3},
		{219.85,113.3},{211.85,136.3},{15.85,300.3},{16.85,338.3}}
	baby_shape2judge = {
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0.0078125,0.015625,0.015625,0.015625,0.015625,0.015625,0.0078125,0},
		{0,0,0,0,0,0,0,0,0,0,0,0.0078125,0.03125,0.03125,0.0625,0.0625,0.0625,0.03125,0.015625,0.015625},
		{0,0,0,0,0,0,0,0,0,0,0.0078125,0.015625,0.0625,0.125,0.125,0.125,0.125,0.125,0.0625,0.03125},
		{0,0,0,0,0,0,0,0,0,0,0.0078125,0.03125,0.125,0.25,0.5,0.5,0.5,0.25,0.125,0.0625},
		{0,0,0,0,0,0,0,0,0,0.0078125,0.015625,0.03125,0.125,0.25,1,1,1,1,0.25,0.125},
		{0,0,0,0,0,0,0,0,0.0078125,0.015625,0.03125,0.125,0.125,0.5,1,1,1,1,0.25,0.125},
		{0,0,0,0,0,0,0,0,0.0078125,0.03125,0.0625,0.25,0.5,0.5,1,1,1,1,0.25,0.125},
		{0,0,0,0,0,0,0,0.0078125,0.015625,0.03125,0.125,0.25,1,1,1,1,1,0.5,0.25,0.0625},
		{0,0,0,0,0,0,0.0078125,0.015625,0.03125,0.0625,0.125,0.5,1,1,1,1,1,1,0.25,0.0625},
		{0,0,0,0,0,0.0078125,0.015625,0.03125,0.0625,0.125,0.25,1,1,1,0.25,0.5,1,1,0.25,0.0625},
		{0,0,0.0078125,0.0078125,0.0078125,0.015625,0.03125,0.0625,0.125,0.25,1,1,1,0.5,0.25,0.5,0.5,0.5,0.25,0.0625},
		{0.0078125,0.015625,0.015625,0.015625,0.03125,0.03125,0.0625,0.125,0.25,1,1,1,1,0.25,0.25,1,1,0.5,0.25,0.0625},
		{0.03125,0.0625,0.0625,0.0625,0.0625,0.125,0.125,0.25,1,1,1,1,0.25,0.125,0.25,1,1,0.5,0.125,0.0625},
		{0.0625,0.125,0.25,0.25,0.25,0.25,0.5,1,1,1,1,0.5,0.125,0.125,0.5,1,1,0.5,0.125,0.0625},
		{0.125,0.25,0.5,1,1,1,1,1,1,1,0.5,0.125,0.125,0.25,1,1,1,0.5,0.125,0.03125},
		{0.25,0.5,1,1,1,1,1,1,0.5,0.25,0.125,0.0625,0.25,0.5,1,1,1,0.25,0.125,0.03125},
		{0.25,1,1,1,0.5,0.5,0.5,0.25,0.25,0.125,0.0625,0.125,0.5,1,1,1,0.5,0.125,0.0625,0.015625},
		{0.25,1,1,1,0.5,0.25,0.25,0.125,0.125,0.25,0.25,0.5,1,1,1,0.5,0.25,0.0625,0.03125,0.0078125},
		{0.25,1,1,1,1,1,1,0.5,0.5,0.5,1,1,1,1,1,0.25,0.125,0.03125,0.015625,0.0078125},
		{0.125,0.25,1,1,1,1,1,1,1,1,1,1,1,1,0.25,0.125,0.0625,0.015625,0.0078125,0},
		{0.0625,0.125,0.25,0.25,0.5,0.5,1,1,1,1,1,0.5,0.5,0.25,0.125,0.0625,0.03125,0.0078125,0,0},
		{0.03125,0.0625,0.0625,0.125,0.125,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.125,0.125,0.0625,0.03125,0.015625,0,0,0},
		{0.015625,0.015625,0.03125,0.03125,0.0625,0.0625,0.0625,0.0625,0.0625,0.0625,0.0625,0.0625,0.0625,0.03125,0.03125,0.0078125,0,0,0,0},
		{0,0.0078125,0.0078125,0.015625,0.015625,0.015625,0.03125,0.03125,0.03125,0.03125,0.03125,0.015625,0.015625,0.015625,0.0078125,0,0,0,0,0},
		{0,0,0,0,0.0078125,0.0078125,0.0078125,0.0078125,0.0078125,0.0078125,0.0078125,0.0078125,0.0078125,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
		{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
		
	baby_scorep1 = 0;
	baby_scorep2 = 0;
	
	baby_bonusmult1P1 = 0;
	baby_score1P1 = {0,0};
	baby_bonusmult2P1 = 0;
	baby_score2P1 = {0,0};
	baby_bonusmult1P2 = 0;
	baby_score1P2 = {0,0};
	baby_bonusmult2P2 = 0;
	baby_score2P2 = {0,0};
	
	baby_shape1P1 = {};
	baby_shape2P1 = {};
	baby_shape1P2 = {};
	baby_shape2P2 = {};
	
	for i=1,table.getn(baby_shape1checkpoint) do
		table.insert(baby_visited1P1,0)
		table.insert(baby_visited1P2,0)
	end
	for i=1,table.getn(baby_shape2checkpoint) do
		table.insert(baby_visited2P1,0)
		table.insert(baby_visited2P2,0)
	end
	for i=1,table.getn(baby_shape1wrongpoint) do
		table.insert(baby_visitedwrong1P1,0)
		table.insert(baby_visitedwrong1P2,0)
	end
	for i=1,table.getn(baby_shape2wrongpoint) do
		table.insert(baby_visitedwrong2P1,0)
		table.insert(baby_visitedwrong2P2,0)
	end
	
	function baby_p1spd()
		return math.sqrt((baby_p1xm*baby_p1xm)+(baby_p1ym*baby_p1ym))
	end
	function baby_p2spd()
		return math.sqrt((baby_p2xm*baby_p2xm)+(baby_p2ym*baby_p2ym))
	end
	
	function baby_getnextavailablebullet(p)
		--[[
		_G['baby_bulletindex'..p] = _G['baby_bulletindex'..p]+1
		if _G['baby_bulletindex'..p]>table.getn(_G['baby_bullets'..p]) then
			_G['baby_bulletindex'..p] = 1
		end
		return _G['baby_bullets'..p][_G['baby_bulletindex'..p]]
		]]
	end
			
	function baby_getnextavailablebulletP1()
		baby_bulletindexP1 = baby_bulletindexP1+1
		if baby_bulletindexP1>table.getn(_G['baby_bullets'..(((baby_drawing-1)*2)+1)]) then
			baby_bulletindexP1 = 1
		end
		return _G['baby_bullets'..(((baby_drawing-1)*2)+1)][baby_bulletindexP1]
	end
			
	function baby_getnextavailablebulletP2()
		baby_bulletindexP2 = baby_bulletindexP2+1
		if baby_bulletindexP2>table.getn(_G['baby_bullets'..(((baby_drawing-1)*2)+2)]) then
			baby_bulletindexP2 = 1
		end
		return _G['baby_bullets'..(((baby_drawing-1)*2)+1)][baby_bulletindexP2]
	end
	
	baby_official1p1 = 0;
	baby_official2p1 = 0;
	baby_official1p2 = 0;
	baby_official2p2 = 0;
	
	function baby_placecrayon(n)
		--Trace((((baby_drawing-1)*2)+1));
		
		local t = _G['baby_getnextavailablebulletP'..n]()
		local px = _G['baby_p'..n..'pos'][1]
		local py = _G['baby_p'..n..'pos'][2]
		t[1]:rotationz(math.random(360));
		t[1]:x(px);
		t[1]:y(py);
		t[1]:hidden(0);
		if baby_drawing == 2 then
			table.insert(_G['baby_shape'..(uksrt5_stage2done+n)],{px,py});
		end
		
		table.insert(_G['baby_shape'..baby_drawing..'P'..n],{px,py});
		
		px = px+16;
		py = py+16;
		
		_G['baby_score'..baby_drawing..'P'..n][1] = _G['baby_score'..baby_drawing..'P'..n][1]+(_G['baby_shape'..baby_drawing..'judge'][math.floor(py/16)][math.floor(px/16)])
		_G['baby_score'..baby_drawing..'P'..n][2] = _G['baby_score'..baby_drawing..'P'..n][2]+1
		
		if _G['baby_score'..baby_drawing..'P'..n][2] > 0 then
			_G['baby_official'..baby_drawing..'P'..n] = _G['baby_bonusmult'..baby_drawing..'P'..n]*(_G['baby_score'..baby_drawing..'P'..n][1]/_G['baby_score'..baby_drawing..'P'..n][2])
			_G['baby_score'..baby_drawing..'p'..n..'text']:settext(baby_scoreformat(_G['baby_official'..baby_drawing..'P'..n])..'%')
		end
		
		if _G['baby_score'..baby_drawing..'P1'][2] > 0 then
		--baby_debug1:settext(_G['baby_bonusmult'..baby_drawing..'P1']*(_G['baby_score'..baby_drawing..'P1'][1]/_G['baby_score'..baby_drawing..'P1'][2]));
		end
		
		--Trace(_G['baby_shape'..baby_drawing..'judge'][math.floor(py/16)][math.floor(px/16)]);
		
	end
	
	function baby_scoreformat(n)
		return (lazy_round(n*10000))/100
	end
	
	function lazy_round(n)
		if (n-math.floor(n))<0.5 then return math.floor(n) else return math.ceil(n) end
	end
	
	function baby_dist(x1,y1,x2,y2)
		return math.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)))
	end
	
	function baby_bullet_code()
		for i=1,table.getn(baby_bulletsP1) do
			baby_bulletsP1[i][1]:hidden(1)
			baby_bulletsP2[i][1]:hidden(1)
		end
	end
	
	function baby_clearscreen()
		for j=1,4 do
			for i=1,table.getn(_G['baby_bullets'..j]) do
				_G['baby_bullets'..j][i][1]:hidden(1)
			end
		end
		baby_bulletindexP1 = 1;
		baby_bulletindexP2 = 1;
	end
			
	function baby_round(num)
		local mult = 10^(2 or 0)
		return math.floor(num * mult + 0.5) / mult
	end
	
	baby_ddropspd = 0.58
	baby_speedmodP1 = 2;
	baby_speedmodP2 = 2;
	
	baby_fwag = 269;
	baby_fwagging = 1;
	
	baby_mini = 284;
	baby_miniing = 1;
	
	baby_nue_shot = 188;
	baby_oddeven = 0;
	baby_shotspeed = 9;
	baby_num_shots = 4;
	baby_nue_next = 2;
			
--lua course :D			
curmod = 1;
--{beat,mod,player}
mods = {
{87.5,'*10000 150 beat'},

{156,'*0.6 150 drunk'},

{172,'*1000 no drunk, *1000 no beat'},
}

curmod2 = 1;
mods2 = {

}

--SCREAMING GUMBALL
curmessage = 1;
--{beat,message,ignoreIfAhead}
messages = {
{190,'ShowCursor'},
{192,'LineOn'},
{252,'HideCursor'},
{255,'ShowCursor'},
{316,'LineOff'},
{316,'HideCursor'},
}

--Sound player
cursound = 1;
sounds = {
}

function baby_sound(soundName)
	SOUND:PlayOnce(songName..'lua/'..soundName);
end
			
		end"
		
		UpdateCommand="%function(self)

			if GAMESTATE:GetSongBeat()>=0.1 and not checked then
				if SCREENMAN:GetTopScreen():GetChild('PlayerP1') then p1on = true; else p1on = false; end
				if SCREENMAN:GetTopScreen():GetChild('PlayerP2') then p2on = true; else p2on = false; end
				
				P1 = SCREENMAN:GetTopScreen():GetChild('PlayerP1');
				P2 = SCREENMAN:GetTopScreen():GetChild('PlayerP2');
				
				if SCREENMAN:GetTopScreen():GetChild('ScoreP1') then ScoreP1 = SCREENMAN:GetTopScreen():GetChild('ScoreP1') end
				if SCREENMAN:GetTopScreen():GetChild('ScoreP2') then ScoreP2 = SCREENMAN:GetTopScreen():GetChild('ScoreP2') end
				
				screen = SCREENMAN:GetTopScreen();
				checked = true;
				
				--MakePages();
				
				for pn=1,2 do
					_G['baby_p'..pn..'c']:x(_G['baby_p'..pn..'pos'][1]+(320*(pn-1)));
					_G['baby_p'..pn..'c']:y(_G['baby_p'..pn..'pos'][2]);
					if not _G['P'..pn] then
						_G['baby_p'..pn..'c']:hidden(1);
					end
				end
				
			end
			
			local beat = GAMESTATE:GetSongBeat();
			
			if beat>0 and fgcurcommand == 1 then
				GAMESTATE:ApplyGameCommand('mod,*1000 1.75x,*1000 no mini, *1000 no reverse');
				fgcurcommand = fgcurcommand+1
			end
			
			if beat>170 and fgcurcommand2 == 1 then
				fgcurcommand2 = fgcurcommand2+1;
			end
			
			if beat>156 and fgcurcommand2 == 1 then
				if P1 then P1:accelerate(7.5); P1:rotationz(-40); P1:y(720); end
				if P2 then P2:accelerate(7.5); P2:rotationz(-40); P2:y(720); end
				fgcurcommand2 = fgcurcommand2+1
			end
			
			if beat>172 and fgcurcommand3 == 1 then
				if P1 then P1:rotationz(0); P1:y(2000); end
				if P2 then P2:rotationz(0); P2:y(2000); end
				fgcurcommand3 = fgcurcommand3+1
			end
			
			if beat>188 and fgcurcommand2 == 2 then
				if P1 then
					baby_pic1:hidden(0);
					baby_pic1:zoom(0);
					baby_pic1:rotationz(60);
					baby_pic1:rotationy(-30);
					baby_pic1:rotationx(-50);
					baby_pic1:bounceend(4/3);
					baby_pic1:zoom(1);
					baby_pic1:rotationz(0);
					baby_pic1:rotationy(0);
					baby_pic1:rotationx(0);
				end
				if P2 then
					baby_pic2:hidden(0);
					baby_pic2:zoom(0);
					baby_pic2:rotationz(60);
					baby_pic2:rotationy(-30);
					baby_pic2:rotationy(50);
					baby_pic2:bounceend(4/3);
					baby_pic2:zoom(1);
					baby_pic2:rotationz(0);
					baby_pic2:rotationy(0);
					baby_pic2:rotationx(0);
				end
				fgcurcommand2 = fgcurcommand2+1
			end
			
			if beat>252 and fgcurcommand2 == 3 then
				if P1 then
					baby_pic1:linear(4/3);
					baby_pic1:addx(-380);
					baby_pic1:rotationz(40);
					baby_pic1:rotationy(-60);
					baby_pic1:rotationx(80);
					
					baby_pic3:hidden(0);
					baby_pic3:zoom(0);
					baby_pic3:rotationz(60);
					baby_pic3:rotationy(-30);
					baby_pic3:rotationy(-50);
					baby_pic3:bounceend(4/3);
					baby_pic3:zoom(1);
					baby_pic3:rotationz(0);
					baby_pic3:rotationy(0);
					baby_pic3:rotationx(0);
				end
				if P2 then
					baby_pic2:linear(4/3);
					baby_pic2:addx(380);
					baby_pic2:rotationz(40);
					baby_pic2:rotationy(60);
					baby_pic2:rotationx(80);
					
					baby_pic4:hidden(0);
					baby_pic4:zoom(0);
					baby_pic4:rotationz(60);
					baby_pic4:rotationy(-30);
					baby_pic4:rotationy(50);
					baby_pic4:bounceend(4/3);
					baby_pic4:zoom(1);
					baby_pic4:rotationz(0);
					baby_pic4:rotationy(0);
					baby_pic4:rotationx(0);
				end
				fgcurcommand2 = fgcurcommand2+1
			end
			
			if beat>316 and fgcurcommand2 == 4 then
				if P1 then
					baby_pic3:linear(4/3);
					baby_pic3:addx(-380);
					baby_pic3:rotationz(40);
					baby_pic3:rotationy(-60);
					baby_pic3:rotationx(80);
				end
				if P2 then
					baby_pic4:linear(4/3);
					baby_pic4:addx(380);
					baby_pic4:rotationz(40);
					baby_pic4:rotationy(60);
					baby_pic4:rotationx(80);
				end
				fgcurcommand2 = fgcurcommand2+1
			end
			
			if beat>192 and fgcurcommand == 2 then
				baby_drawing = 1;
				fgcurcommand = fgcurcommand+1
			end
			if beat>252 and fgcurcommand == 3 then
				baby_drawing = 0;
				fgcurcommand = fgcurcommand+1
			end
			
			if beat>254.5 and fgcurcommand == 4 then
				
				for pn=1,2 do
				
					_G['baby_p'..pn..'xm'] = 0;
					_G['baby_p'..pn..'ym'] = 0;
					
					_G['baby_p'..pn..'pos'][1] = 160;
					_G['baby_p'..pn..'pos'][2] = 360;
					
					_G['baby_p'..pn..'c']:x(160+(320*(pn-1)));
					_G['baby_p'..pn..'c']:y(360);
						
				end
				
				fgcurcommand = fgcurcommand+1
			end
			
			if beat>256 and fgcurcommand == 5 then
				baby_clearscreen();
				baby_drawing = 2;
				fgcurcommand = fgcurcommand+1
			end
			if beat>316 and fgcurcommand == 6 then
				baby_drawing = 0;
				if P1 then P1:linear(2/3); P1:y(240); end
				if P2 then P2:linear(2/3); P2:y(240); end
				fgcurcommand = fgcurcommand+1
			end
			
			if beat>324 and fgcurcommand == 7 then
				baby_clearscreen();
				baby_scorep1 = (baby_official1p1+baby_official2p1)*25
				baby_scorep2 = (baby_official1p2+baby_official2p2)*25
				MESSAGEMAN:Broadcast('ShowScores');
				fgcurcommand = fgcurcommand+1
			end
			
			if beat>356 and fgcurcommand == 8 then
				--[[if P1 then
					baby_populatepage(1,1);
					baby_populatepage(2,1);
				end
				if P2 then
					baby_populatepage(1,2);
					baby_populatepage(2,2);
				end]]
				if P1 then
					baby_pic1:zoom(0);
					baby_pic1:x(160-30);
					baby_pic1:y(240-30);
					baby_pic1:rotationz(0);
					baby_pic1:rotationy(0);
					baby_pic1:rotationx(0);
					baby_pic1:wag();
					baby_pic1:effectmagnitude(0,0,10);
					baby_pic1:bounceend(2/3);
					baby_pic1:zoom(0.8);
					
					baby_pic3:zoom(0);
					baby_pic3:x(160+30);
					baby_pic3:y(240+30);
					baby_pic3:rotationz(0);
					baby_pic3:rotationy(0);
					baby_pic3:rotationx(0);
					baby_pic3:wag();
					baby_pic3:effectmagnitude(0,0,10);
					baby_pic3:bounceend(2/3);
					baby_pic3:zoom(0.8);
				end
				if P2 then
					baby_pic2:zoom(0);
					baby_pic2:x(480-30);
					baby_pic2:y(240-30);
					baby_pic2:rotationz(0);
					baby_pic2:rotationy(0);
					baby_pic2:rotationx(0);
					baby_pic2:wag();
					baby_pic2:effectmagnitude(0,0,10);
					baby_pic2:bounceend(2/3);
					baby_pic2:zoom(0.8);
					
					baby_pic4:zoom(0);
					baby_pic4:x(480+30);
					baby_pic4:y(240+30);
					baby_pic4:rotationz(0);
					baby_pic4:rotationy(0);
					baby_pic4:rotationx(0);
					baby_pic4:wag();
					baby_pic4:effectmagnitude(0,0,10);
					baby_pic4:bounceend(2/3);
					baby_pic4:zoom(0.8);
				end
				fgcurcommand = fgcurcommand+1
			end
			
			if baby_drawing > 0 then
			
				for pn=1,2 do
				
					if _G['DpressP'..pn] == 1 and _G['UpressP'..pn] == 0 then
						if _G['baby_p'..pn..'ym'] < baby_maxspd then
							_G['baby_p'..pn..'ym'] = _G['baby_p'..pn..'ym']+baby_accel;
						end
						if _G['baby_p'..pn..'ym'] < 0 then
							_G['baby_p'..pn..'ym'] = _G['baby_p'..pn..'ym']+baby_decel;
						end
					end
					if _G['UpressP'..pn] == 1 and _G['DpressP'..pn] == 0 then
						if _G['baby_p'..pn..'ym'] > baby_maxspd*-1 then
							_G['baby_p'..pn..'ym'] = _G['baby_p'..pn..'ym']-baby_accel;
						end
						if _G['baby_p'..pn..'ym'] > 0 then
							_G['baby_p'..pn..'ym'] = _G['baby_p'..pn..'ym']-baby_decel;
						end
					end
					if (_G['DpressP'..pn] == 1 and _G['UpressP'..pn] == 1 or
						_G['DpressP'..pn] == 0 and _G['UpressP'..pn] == 0) then
						if math.abs(_G['baby_p'..pn..'ym']) > baby_decel then
							if _G['baby_p'..pn..'ym'] > 0 then
								_G['baby_p'..pn..'ym'] = _G['baby_p'..pn..'ym']-baby_decel;
							else
								_G['baby_p'..pn..'ym'] = _G['baby_p'..pn..'ym']+baby_decel;
							end
						else
							_G['baby_p'..pn..'ym'] = 0;
						end
					end
					
					if _G['RpressP'..pn] == 1 and _G['LpressP'..pn] == 0 then
						if _G['baby_p'..pn..'xm'] < baby_maxspd then
							_G['baby_p'..pn..'xm'] = _G['baby_p'..pn..'xm']+baby_accel;
						end
						if _G['baby_p'..pn..'xm'] < 0 then
							_G['baby_p'..pn..'xm'] = _G['baby_p'..pn..'xm']+baby_decel;
						end
					end
					if _G['LpressP'..pn] == 1 and _G['RpressP'..pn] == 0 then
						if _G['baby_p'..pn..'xm'] > baby_maxspd*-1 then
							_G['baby_p'..pn..'xm'] = _G['baby_p'..pn..'xm']-baby_accel;
						end
						if _G['baby_p'..pn..'xm'] > 0 then
							_G['baby_p'..pn..'xm'] = _G['baby_p'..pn..'xm']-baby_decel;
						end
					end
					if (_G['RpressP'..pn] == 1 and _G['LpressP'..pn] == 1 or
						_G['RpressP'..pn] == 0 and _G['LpressP'..pn] == 0) then
						if math.abs(_G['baby_p'..pn..'xm']) > baby_decel then
							if _G['baby_p'..pn..'xm'] > 0 then
								_G['baby_p'..pn..'xm'] = _G['baby_p'..pn..'xm']-baby_decel;
							else
								_G['baby_p'..pn..'xm'] = _G['baby_p'..pn..'xm']+baby_decel;
							end
						else
							_G['baby_p'..pn..'xm'] = 0
						end
					end
					
					_G['baby_p'..pn..'pos'][1] = _G['baby_p'..pn..'pos'][1]+_G['baby_p'..pn..'xm']
					_G['baby_p'..pn..'pos'][2] = _G['baby_p'..pn..'pos'][2]+_G['baby_p'..pn..'ym']
					
					for i=1,table.getn(_G['baby_shape'..baby_drawing..'checkpoint']) do
						if _G['baby_visited'..baby_drawing..'P'..pn][i] == 0 and baby_dist(_G['baby_p'..pn..'pos'][1],_G['baby_p'..pn..'pos'][2],_G['baby_shape'..baby_drawing..'checkpoint'][i][1],_G['baby_shape'..baby_drawing..'checkpoint'][i][2]) < 16 then
							_G['baby_visited'..baby_drawing..'P'..pn][i] = 1;
							_G['baby_bonusmult'..baby_drawing..'P'..pn] = _G['baby_bonusmult'..baby_drawing..'P'..pn]+(1/table.getn(_G['baby_shape'..baby_drawing..'checkpoint']));
						end
					end
					for i=1,table.getn(_G['baby_shape'..baby_drawing..'wrongpoint']) do
						if _G['baby_visitedwrong'..baby_drawing..'P'..pn][i] == 0 and baby_dist(_G['baby_p'..pn..'pos'][1],_G['baby_p'..pn..'pos'][2],_G['baby_shape'..baby_drawing..'wrongpoint'][i][1],_G['baby_shape'..baby_drawing..'wrongpoint'][i][2]) < 10 then
							_G['baby_visitedwrong'..baby_drawing..'P'..pn][i] = 1;
							_G['baby_bonusmult'..baby_drawing..'P'..pn] = _G['baby_bonusmult'..baby_drawing..'P'..pn]-(1/table.getn(_G['baby_shape'..baby_drawing..'checkpoint']));
						end
					end
					
					--stay in bounds
					if _G['baby_p'..pn..'pos'][1] > baby_paper_xmax then
						_G['baby_p'..pn..'pos'][1] = baby_paper_xmax;
						_G['baby_p'..pn..'xm'] = math.abs(_G['baby_p'..pn..'xm'])*-1
					end
					if _G['baby_p'..pn..'pos'][1] < baby_paper_xmin then
						_G['baby_p'..pn..'pos'][1] = baby_paper_xmin;
						_G['baby_p'..pn..'xm'] = math.abs(_G['baby_p'..pn..'xm'])*1
					end
					if _G['baby_p'..pn..'pos'][2] > baby_paper_ymax then
						_G['baby_p'..pn..'pos'][2] = baby_paper_ymax;
						_G['baby_p'..pn..'ym'] = math.abs(_G['baby_p'..pn..'ym'])*-1
					end
					if _G['baby_p'..pn..'pos'][2] < baby_paper_ymin then
						_G['baby_p'..pn..'pos'][2] = baby_paper_ymin;
						_G['baby_p'..pn..'ym'] = math.abs(_G['baby_p'..pn..'ym'])*1
					end
			
					_G['baby_p'..pn..'c']:x(_G['baby_p'..pn..'pos'][1]+(320*(pn-1)));
					_G['baby_p'..pn..'c']:y(_G['baby_p'..pn..'pos'][2]);
					_G['baby_p'..pn..'c']:hidden(0);
				
				end
				
				--Trace(baby_p1xm);
				
				baby_drawtimerp1 = baby_drawtimerp1-baby_p1spd()
				if baby_drawtimerp1<=0 then
					baby_placecrayon(1);
					baby_drawtimerp1 = baby_drawtimerp1+baby_drawres
				end
				
				baby_drawtimerp2 = baby_drawtimerp2-baby_p2spd()
				if baby_drawtimerp2<=0 then
					baby_placecrayon(2);
					baby_drawtimerp2 = baby_drawtimerp2+baby_drawres
				end
				
			else
				
			end
			
---------------------------------------------------------------------------------------
----------------------DON'T TOUCH IT KIDDO---------------------------------------------
---------------------------------------------------------------------------------------
			
			disable = false;
			if disable ~= true then
					
			--custom mod reader (c) 2012 #taronuke #yolo #swag #swag #amazon.co.jp #teamproofofconcept #swag
			if curmod<=table.getn(mods) and GAMESTATE:GetSongBeat()>=mods[curmod][1] then
				if table.getn(mods[curmod]) == 3 then
					GAMESTATE:ApplyGameCommand('mod,'..mods[curmod][2],mods[curmod][3]);
				else
					GAMESTATE:ApplyGameCommand('mod,'..mods[curmod][2]);
				end
				curmod = curmod+1;
			end
			
			--custom mod reader (c) 2012 #taronuke #yolo #swag #swag #amazon.co.jp #teamproofofconcept #swag
			while curmod2<=table.getn(mods2) and GAMESTATE:GetSongBeat()>=mods2[curmod2][1] do
				if table.getn(mods2[curmod2]) == 3 then
					GAMESTATE:ApplyGameCommand('mod,'..mods2[curmod2][2],mods2[curmod2][3]);
				else
					GAMESTATE:ApplyGameCommand('mod,'..mods2[curmod2][2]);
				end
				curmod2 = curmod2+1;
			end
			
			--SCREAMING GUMBALL
			if curmessage<=table.getn(messages) and GAMESTATE:GetSongBeat()>=messages[curmessage][1] then
				if messages[curmessage][3] and GAMESTATE:GetSongBeat()>=messages[curmessage][1]+5 then
					curmessage = curmessage+1;
				else
					MESSAGEMAN:Broadcast(messages[curmessage][2]);
					curmessage = curmessage+1;
				end
			end
			
			--Sound player
			while cursound<=table.getn(sounds) and GAMESTATE:GetSongBeat()>=sounds[cursound][1] do
				if GAMESTATE:GetSongBeat()>=sounds[cursound][1]+5 then
					cursound = cursound+1;
				else
					baby_sound(sounds[cursound][2]);
					cursound = cursound+1;
				end
			end
			
			end
			
			self:queuecommand('Update2');

---------------------------------------------------------------------------------------
----------------------END DON'T TOUCH IT KIDDO-----------------------------------------
---------------------------------------------------------------------------------------
			
		end"
  
		Update2Command="%function(self)
			self:sleep(0.02);
			self:queuecommand('Update');
		end"
		
	/>
	
	<!--Layer File="crayon.xml"/-->
	<Layer Type="ActorFrame" OnCommand="%function(self) baby_pic1 = self; end" InitCommand="x,160;y,240;hidden,1;"><children>
		<Layer File="paper1"/>
		<Layer File="shape1" InitCommand="diffusealpha,0.3"/>
		<Layer File="page1.xml" InitCommand="x,-160;y,-240" />
		<Layer File="_eurostile outline" OnCommand="%function(self) baby_score1p1text = self; end"
		Text="" InitCommand="zoom,0.8;x,-145;y,130;shadowlength,0;horizalign,left;diffusealpha,0" ShowScoresMessageCommand="diffusealpha,1" />
	</children></Layer>
	
	<Layer Type="ActorFrame" OnCommand="%function(self) baby_pic2 = self; end" InitCommand="x,480;y,240;hidden,1;"><children>
		<Layer File="paper2"/>
		<Layer File="shape1" InitCommand="diffusealpha,0.3"/>
		<Layer File="page2.xml" InitCommand="x,-160;y,-240" />
		<Layer File="_eurostile outline" OnCommand="%function(self) baby_score1p2text = self; end"
		Text="" InitCommand="zoom,0.8;x,-145;y,130;shadowlength,0;horizalign,left;diffusealpha,0" ShowScoresMessageCommand="diffusealpha,1" />
	</children></Layer>
	
	<Layer Type="ActorFrame" OnCommand="%function(self) baby_pic3 = self; end" InitCommand="x,160;y,240;hidden,1;"><children>
		<Layer File="paper3"/>
		<Layer File="shape2" InitCommand="diffusealpha,0.3"/>
		<Layer File="page3.xml" InitCommand="x,-160;y,-240" />
		<Layer File="_eurostile outline" OnCommand="%function(self) baby_score2p1text = self; end"
		Text="" InitCommand="zoom,0.8;x,-145;y,130;shadowlength,0;horizalign,left;diffusealpha,0" ShowScoresMessageCommand="diffusealpha,1" />
	</children></Layer>
	
	<Layer Type="ActorFrame" OnCommand="%function(self) baby_pic4 = self; end" InitCommand="x,480;y,240;hidden,1;"><children>
		<Layer File="paper4"/>
		<Layer File="shape2" InitCommand="diffusealpha,0.3" />
		<Layer File="page4.xml" InitCommand="x,-160;y,-240" />
		<Layer File="_eurostile outline" OnCommand="%function(self) baby_score2p2text = self; end"
		Text="" InitCommand="zoom,0.8;x,-145;y,130;shadowlength,0;horizalign,left;diffusealpha,0" ShowScoresMessageCommand="diffusealpha,1" />
	</children></Layer>
	
	<Layer
		File="line.png"
		OnCommand="x,320;y,240;zoomtoheight,SCREEN_HEIGHT;diffusealpha,0"
		LineOnMessageCommand="diffusealpha,1"
		LineOffMessageCommand="diffusealpha,0"
	/>
	
	<Layer Type="ActorFrame" OnCommand="%function(self) baby_p1c = self; end"><children>
		<Layer File="cursor" InitCommand="diffusealpha,0" HideCursorMessageCommand="linear,0.5;diffusealpha,0"
		ShowCursorMessageCommand="linear,0.5;diffusealpha,0"/>
		<Layer File="crayonp1" InitCommand="diffusealpha,0;x,50;y,-160" HideCursorMessageCommand="linear,2/3;diffusealpha,0;x,50;y,-160"
		ShowCursorMessageCommand="linear,1/3;diffusealpha,1;x,20;y,-70"/>
	</children></Layer>
	<Layer Type="ActorFrame" OnCommand="%function(self) baby_p2c = self; end"><children>
		<Layer File="cursor" InitCommand="diffusealpha,0" HideCursorMessageCommand="linear,0.5;diffusealpha,0"
		ShowCursorMessageCommand="linear,1/3;diffusealpha,0"/>
		<Layer File="crayonp2" InitCommand="diffusealpha,0;x,50;y,-160" HideCursorMessageCommand="linear,2/3;diffusealpha,0;x,50;y,-160"
		ShowCursorMessageCommand="linear,1/3;diffusealpha,1;x,20;y,-70"/>
	</children></Layer>
	
	<Layer File="_eurostile outline" OnCommand="%function(self) baby_debug1 = self; end"
		Text="" InitCommand="zoom,1;x,160;y,400;shadowlength,0"/>
	
</children></ActorFrame>