	local Coins = GAMESTATE:GetCoins()
	local CoinForCredit = GAMESTATE:GetCoinsNeededToJoin()
	local Credits = math.floor(Coins/CoinForCredit)
	local Remain = Coins % CoinForCredit	

local function CreditsText( pn )
	local text = LoadFont("credits") .. {
	
		UpdateCreditTextCommand=function(self)
		self:visible(false);
		if GAMESTATE:GetCoinMode() == 'CoinMode_Pay' then
		self:visible(true);
		self:settext(string.format("CRDTS(%i)",GAMESTATE:GetCoins()));		
		end
		end;
	
		InitCommand=function(self)
			self:playcommand("UpdateCreditText");			
		end;
		RefreshCreditTextMessageCommand=function(self)
			self:playcommand("UpdateCreditText");			
		end;
		CoinInsertedMessageCommand=function(self)
			self:playcommand("UpdateCreditText");		
		end;
		PlayerJoinedMessageCommand=function(self)
			self:playcommand("UpdateCreditText");			
		end;
		ScreenChangedMessageCommand=function(self)
			self:playcommand("UpdateCreditText");			
		end;
	};
	return text;
end

local t =  Def.ActorFrame {	
	Def.ActorFrame {
		SystemMessageMessageCommand = function(self, params)
			self:GetChild("Text"):settext( params.Message );
			self:playcommand( "On" );
			if params.NoAnimate then
				self:finishtweening();
			end
			self:playcommand( "Off" );
		end;
		HideSystemMessageMessageCommand = cmd(finishtweening);
	};
		CreditsText(PLAYER_1) .. {
			InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_BOTTOM-10;);
			
		};
		
	--- to stop people in widescreen viewing offscreen elements
	-- ez2dancer is not a widescreen game
	Def.Quad {
		OnCommand=cmd(stretchto,SCREEN_RIGHT,SCREEN_TOP,99999,SCREEN_BOTTOM;diffuse,color("#000000"));
	};
	
	Def.Quad {
		OnCommand=cmd(stretchto,-99999,SCREEN_TOP,SCREEN_LEFT,SCREEN_BOTTOM;diffuse,color("#000000"));
	};


	Def.Quad {
		OnCommand=cmd(stretchto,-99999,-99999,99999,SCREEN_TOP;diffuse,color("#000000"));
	};
	
	
	Def.Quad {
		OnCommand=cmd(stretchto,-99999,SCREEN_BOTTOM,99999,99999;diffuse,color("#000000"));
	};	

	

};
return t;
