function OnSceneLoad(screen)
    LoadData(screen)
    DefaultOnSceneLoad('data/Scenes/40_Credits.lua', 'clean')
    
    PlayAmbientMusic("music2", true);
    
    local textBox = CreateTextEntity(INGAME_MENU_FONT, 'TO_BE_CONTINUED');
    textBox:AttachTo(screen);
    textBox:SetXY(512, 384);
    
    local eff = CreateAnimationEffector();
    eff:SetKey(_TRACK_O, 0.0, 0.0)
    eff:SetKey(_TRACK_O, 2.0, 1.0)
    eff:SetKey(_TRACK_O, 4.0, 1.0)
    eff:SetKey(_TRACK_O, 6.0, 0.0)
    eff:AttachTo(textBox);
    eff:Play();
    
    play_field:GetObject('field_top'):SetOpacity(0.0)
    play_field:GetObject('field_bottom'):SetOpacity(0.0)
    
    TimerDoString("ShowCredits()", 6, play_field:GetTimer());
    
end

local CreditsSeparatorX = 680;

function ShowCredits()

    local creditsScreen = CreateCreditsScreen();
    creditsScreen:AttachTo(play_field);
    creditsScreen:SetZ(55);
    creditsScreen:SetCyclic(false);
    creditsScreen:SetSpeed(50);
    creditsScreen:SetScale(0.5);
    creditsScreen:SetRect(CreditsSeparatorX, 0, 1024 - CreditsSeparatorX, 768);
    
    local skipButton = MakeButton(1024 - 40, 30, 100, 30);
    skipButton:SetSpriteUp("SkipButton");
	skipButton:SetSpriteOver("SkipButtonOver");
	skipButton:SetSpriteDown("SkipButtonDown");
	skipButton:SetActionSound("Menu_button_click");
	
	skipButton:AttachTo(play_field);
	skipButton:SetAction("CreditsFinished");
	skipButton:SetZ(102);
	skipButton:SetKeyEquivalent(KEY_ESCAPE);
	
	local creditsCompos = BuildCreditsComposition();
	creditsCompos:AttachTo(play_field);
	creditsCompos:SetZ(50);
	
	play_field:GetObject('field_top'):SetOpacity(1)
    play_field:GetObject('field_bottom'):SetOpacity(1)
    
end

function CreditsFinished()

    if (play_field.skippingCredits)
    then
        return;
    end

    play_field.skippingCredits = true;

    local fadeDuration = 4;
    
    local eff = CreateAnimationEffector();
    eff:SetKey(_TRACK_O, 0, 1);
    eff:SetKey(_TRACK_O, fadeDuration, 0);
    eff:AttachTo(play_field);
    --eff:Play();
    
    GM:GetCurrPlayer().m_gameState:Clear();
    
    TimerDoString("exitConfirmationScreen = 1;" ..
                  "ExitToMainMenu();"..
                  "exitConfirmationScreen = nil;",
                  0.5, play_field:GetTimer());
end

function BuildCreditsComposition()

        createCompositionCredits = function()
    
        local compositionCredits = CreateCompositionSequence();
        local compositionDuration = 60;
        compositionCredits:SetDuration(compositionDuration);
    
    --[[
        -- Layer logo
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/logo.png");
        element:SetName("logo");
        compositionCredits:AddElement(element);
        element:SetHotSpot(168.5, 78.5);
        element:SetParentElement(compositionCredits);
        element:SetXY(512, 61.3456268310547);
    
        element:SetScaleX(1);
        element:SetScaleY(1);
        element:SetAngle(0);
        element:SetOpacity(1);
    
        effector = element:GetEffector();
        effector:SetLifeTime(0, 60);
    
    
        effector:Play();
    --]]
    
        -- Layer margin_1
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/field.jpg");
        element:SetName("margin_1");
        compositionCredits:AddElement(element);
        element:SetHotSpot(512, 29.5);
        element:SetParentElement(compositionCredits);
        element:SetXY(514.359436035156, 27.1336517333984);
    
        element:SetScaleX(1.02073732718894);
        element:SetScaleY(1);
        element:SetAngle(0);
        element:SetOpacity(1);
    
        effector = element:GetEffector();
        effector:SetLifeTime(0, 60);
    
    
        effector:Play();
    
    
        -- Layer margin_2
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/field.jpg");
        element:SetName("margin_2");
        compositionCredits:AddElement(element);
        element:SetHotSpot(512, 29.5);
        element:SetParentElement(compositionCredits);
        element:SetXY(514.359436035156, 739.686645507813);
    
        element:SetScaleX(1.02073732718894);
        element:SetScaleY(1);
        element:SetAngle(0);
        element:SetOpacity(1);
    
        effector = element:GetEffector();
        effector:SetLifeTime(0, 60);
    
    
        effector:Play();
    
    
        -- Layer mask_compos
        local element = createCompositionMaskComp();
        element:SetName("mask_compos");
        compositionCredits:AddElement(element);
        element:SetHotSpot(330, 384);
        element:SetParentElement(compositionCredits);
        element:SetXY(376.728103637695, 384);
    
        element:SetAngle(0);
        element:SetOpacity(1);
    
        effector = element:GetEffector();
        --effector:SetLifeTime(0, 5.04166666666667);
        --effector:SetLifeTime(0, 100);
    
        effector:Play();
    
    
        -- Layer horse_4
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/horse_4.png");
        element:SetName("horse_4");
        compositionCredits:AddElement(element);
        element:SetHotSpot(344.5, 351.5);
        compositionCredits:RegisterParentInfo("horse_4", "BG_1");
        element:SetXY(578.271690399474, 385.474670410156);
    
        element:SetScaleX(1);
        element:SetScaleY(1);
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(48.6666666666667, 79.3333333333333);
    
        effector:SetKey(_TRACK_O, 48.6666666666667, 0);
        effector:SetKey(_TRACK_O, 49.6666666666667, 1);
        effector:SetKey(_TRACK_O, 50.8333333333333, 1);
        effector:SetKey(_TRACK_O, 51.9583333333333, 0);
    
        effector:Play();
    
    
        -- Layer horse_3
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/horse_3.png");
        element:SetName("horse_3");
        compositionCredits:AddElement(element);
        element:SetHotSpot(172.5, 178);
        compositionCredits:RegisterParentInfo("horse_3", "BG_1");
        element:SetXY(525.184150726622, 348.903228759766);
    
        element:SetScaleX(1);
        element:SetScaleY(1);
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(45.2916666666667, 75.9583333333333);
    
        effector:SetKey(_TRACK_O, 45.2916666666667, 0);
        effector:SetKey(_TRACK_O, 46.2916666666667, 1);
        effector:SetKey(_TRACK_O, 47.4583333333333, 1);
        effector:SetKey(_TRACK_O, 48.5833333333333, 0);
    
        effector:Play();
    
    
        -- Layer horse_2
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/horse_2.png");
        element:SetName("horse_2");
        compositionCredits:AddElement(element);
        element:SetHotSpot(89.5, 61.5);
        compositionCredits:RegisterParentInfo("horse_2", "BG_1");
        element:SetXY(536.981376678771, 321.769592285156);
    
        element:SetScaleX(1);
        element:SetScaleY(1);
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(41.875, 72.5416666666667);
    
        effector:SetKey(_TRACK_O, 41.875, 0);
        effector:SetKey(_TRACK_O, 42.875, 1);
        effector:SetKey(_TRACK_O, 44.0416666666667, 1);
        effector:SetKey(_TRACK_O, 45.1666666666667, 0);
    
        effector:Play();
    
    
        -- Layer horse_1
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/horse_1.png");
        element:SetName("horse_1");
        compositionCredits:AddElement(element);
        element:SetHotSpot(80.5, 50.5);
        compositionCredits:RegisterParentInfo("horse_1", "BG_1");
        element:SetXY(605.405342132872, 313.511535644531);
    
        element:SetScaleX(1);
        element:SetScaleY(1);
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(37.9166666666667, 68.5833333333333);
    
        effector:SetKey(_TRACK_O, 37.9166666666667, 0);
        effector:SetKey(_TRACK_O, 38.9166666666667, 1);
        effector:SetKey(_TRACK_O, 40.0833333333333, 1);
        effector:SetKey(_TRACK_O, 41.2083333333333, 0);
    
        effector:Play();
    
    
        -- Layer BG_1
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/sb2_horse_back.jpg");
        element:SetName("BG_1");
        compositionCredits:AddElement(element);
        element:SetHotSpot(512, 320);
        element:SetParentElement(compositionCredits);
        element:SetScaleX(1);
        element:SetScaleY(1);
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(36.0416666666667, 67.2083333333333);
    
        effector:SetKey(_TRACK_X, 36.0416666666667, 188.755767822266);
        effector:SetKey(_TRACK_Y, 36.0416666666667, 378.101379394531);
        effector:SetKey(_TRACK_X, 59.8333333333333, 513.179733276367);
        effector:SetKey(_TRACK_Y, 59.8333333333333, 378.101379394531);
        effector:SetKey(_TRACK_O, 36.0416666666667, 0);
        effector:SetKey(_TRACK_O, 37.25, 1);
    
        effector:Play();
    
    
        -- Layer BG_2
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/boy_mammy_1024.jpg");
        element:SetName("BG_2");
        compositionCredits:AddElement(element);
        element:SetHotSpot(512, 384);
        element:SetParentElement(compositionCredits);
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(21.3333333333333, 64.9166666666667);
    
        effector:SetKey(_TRACK_X, 21.3333333333333, 286.672805786133);
        effector:SetKey(_TRACK_Y, 21.3333333333333, 398.156677246094);
        effector:SetKey(_TRACK_X, 35.25, 384.589874267578);
        effector:SetKey(_TRACK_Y, 35.25, 373.382476806641);
        effector:SetKey(_TRACK_SX, 21.3333333333333, 1);
        effector:SetKey(_TRACK_SY, 21.3333333333333, 1);
        effector:SetKey(_TRACK_SX, 35.25, 0.82);
        effector:SetKey(_TRACK_SY, 35.25, 0.82);
        effector:SetKey(_TRACK_O, 21.3333333333333, 0);
        effector:SetKey(_TRACK_O, 23.25, 1);
        effector:SetKey(_TRACK_O, 33.4583333333333, 1);
        effector:SetKey(_TRACK_O, 35.25, 0.01);
    
        effector:Play();
    
    
        -- Layer BG_3
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/sb_4_boy.png");
        element:SetName("BG_3");
        compositionCredits:AddElement(element);
        element:SetHotSpot(116, 192.5);
        compositionCredits:RegisterParentInfo("BG_3", "BG_4");
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(0, 60);
    
        effector:SetKey(_TRACK_X, 17.0416666666667, 356.209107216818);
        effector:SetKey(_TRACK_Y, 17.0416666666667, 555.731141812734);
        effector:SetKey(_TRACK_X, 17.0833333333333, 464.274883187756);
        effector:SetKey(_TRACK_Y, 17.0833333333333, 576.31509914053);
        effector:SetKey(_TRACK_X, 17.375, 464.274883187756);
        effector:SetKey(_TRACK_Y, 17.375, 576.31509914053);
        effector:SetKey(_TRACK_X, 18.2083333333333, 464.274883187756);
        effector:SetKey(_TRACK_Y, 18.2083333333333, 576.31509914053);
        effector:SetKey(_TRACK_X, 18.5, 464.274883187756);
        effector:SetKey(_TRACK_Y, 18.5, 576.31509914053);
        effector:SetKey(_TRACK_X, 18.5416666666667, 602.834901900331);
        effector:SetKey(_TRACK_Y, 18.5416666666667, 569.472629080649);
        effector:SetKey(_TRACK_SX, 17.0416666666667, 0.9324113916156);
        effector:SetKey(_TRACK_SY, 17.0416666666667, 0.9324113916156);
        effector:SetKey(_TRACK_SX, 17.0833333333333, 0.59230290128562);
        effector:SetKey(_TRACK_SY, 17.0833333333333, 0.59230290128562);
        effector:SetKey(_TRACK_SX, 17.375, 0.59230290128562);
        effector:SetKey(_TRACK_SY, 17.375, 0.59230290128562);
        effector:SetKey(_TRACK_SX, 18.2083333333333, 0.59230290128562);
        effector:SetKey(_TRACK_SY, 18.2083333333333, 0.59230290128562);
        effector:SetKey(_TRACK_SX, 18.5, 0.59230290128562);
        effector:SetKey(_TRACK_SY, 18.5, 0.59230290128562);
        effector:SetKey(_TRACK_SX, 18.5416666666667, 0.38584906327198);
        effector:SetKey(_TRACK_SY, 18.5416666666667, 0.38584906327198);
        effector:SetKey(_TRACK_O, 15.8333333333333, 0);
        effector:SetKey(_TRACK_O, 16.25, 1);
        effector:SetKey(_TRACK_O, 16.75, 1);
        effector:SetKey(_TRACK_O, 17.0416666666667, 0);
        effector:SetKey(_TRACK_O, 17.0833333333333, 0);
        effector:SetKey(_TRACK_O, 17.375, 1);
        effector:SetKey(_TRACK_O, 18.2083333333333, 1);
        effector:SetKey(_TRACK_O, 18.5, 0);
        effector:SetKey(_TRACK_O, 18.5416666666667, 0);
        effector:SetKey(_TRACK_O, 18.875, 1);
        effector:SetKey(_TRACK_O, 20.25, 1);
        effector:SetKey(_TRACK_O, 21.2916666666667, 0);
    
        effector:Play();
    
    
        -- Layer BG_4
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/sb_4_final.jpg");
        element:SetName("BG_4");
        compositionCredits:AddElement(element);
        element:SetHotSpot(768, 320);
        element:SetParentElement(compositionCredits);
    
        effector = element:GetEffector();
        effector:SetLifeTime(5.91666666666667, 60);
    
        effector:SetKey(_TRACK_X, 5.91666666666667, -254);
        effector:SetKey(_TRACK_Y, 5.91666666666667, 422);
        effector:SetKey(_TRACK_X, 16.125, 552.100243063933);
        effector:SetKey(_TRACK_Y, 16.125, 367.149922707679);
        effector:SetKey(_TRACK_X, 21.375, 675);
        effector:SetKey(_TRACK_Y, 21.375, 280);
        effector:SetKey(_TRACK_SX, 5.91666666666667, 1.24583333333334);
        effector:SetKey(_TRACK_SY, 5.91666666666667, 1.24583333333334);
        effector:SetKey(_TRACK_SX, 16.125, 1.07238630489172);
        effector:SetKey(_TRACK_SY, 16.125, 1.07238630489172);
        effector:SetKey(_TRACK_SX, 21.375, 1.34197916666667);
        effector:SetKey(_TRACK_SY, 21.375, 1.34197916666667);
        effector:SetKey(_TRACK_A, 5.91666666666667, 0.06560311012134);
        effector:SetKey(_TRACK_A, 16.0416666666667, 0);
        effector:SetKey(_TRACK_O, 5.91666666666667, 0);
        effector:SetKey(_TRACK_O, 7.125, 1);
        effector:SetKey(_TRACK_O, 20.2083333333333, 1);
        effector:SetKey(_TRACK_O, 21.2916666666667, 0);
    
        effector:Play();
    
    
        -- Layer Boy_running
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/sb_1.jpg");
        element:SetName("Boy_running");
        compositionCredits:AddElement(element);
        element:SetHotSpot(512, 384);
        element:SetParentElement(compositionCredits);
        element:SetAngle(0);
    
        effector = element:GetEffector();
        effector:SetLifeTime(0, 60);
    
        effector:SetKey(_TRACK_X, 0, 196.456619262695);
        effector:SetKey(_TRACK_Y, 0, 381.520004272461);
        effector:SetKey(_TRACK_X, 5.91666666666667, 415.383453369141);
        effector:SetKey(_TRACK_Y, 5.91666666666667, 381.520004272461);
        effector:SetKey(_TRACK_SX, 0, 1.04616918025689);
        effector:SetKey(_TRACK_SY, 0, 1.04616918025689);
        effector:SetKey(_TRACK_SX, 5.91666666666667, 0.81065088757396);
        effector:SetKey(_TRACK_SY, 5.91666666666667, 0.81065088757396);
        effector:SetKey(_TRACK_O, 0, 0);
        effector:SetKey(_TRACK_O, 0.75, 1);
        effector:SetKey(_TRACK_O, 4.75, 1);
        effector:SetKey(_TRACK_O, 5.91666666666667, 0);
    
        effector:Play();
    
    
        -- Layer BG
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/back.jpg");
        element:SetName("BG");
        compositionCredits:AddElement(element);
        element:SetHotSpot(50, 37.5);
        element:SetParentElement(compositionCredits);
        element:SetXY(512, 384);
    
        element:SetScaleX(11.57);
        element:SetScaleY(11.57);
        element:SetAngle(0);
        element:SetOpacity(1);
    
        effector = element:GetEffector();
        effector:SetLifeTime(0, 60);
    
    
        effector:Play();
    
        compositionCredits:Play();
    
        return compositionCredits;
    end
    
    createCompositionMaskComp = function()
    
        local compositionMaskComp = CreateCompositionSequence();
        local compositionDuration = 5.04166666666667;
        compositionMaskComp:SetDuration(compositionDuration);
    
    
        -- Layer Mask
        local element = CreateCompositionElement("data/Texture/Scenes/40_Credits/mask.png");
        element:SetName("Mask");
        compositionMaskComp:AddElement(element);
        compositionMaskComp:SetCyclic(true);
        element:SetHotSpot(512, 384);
        element:SetParentElement(compositionMaskComp);
        element:SetXY(512, 384);
    
        element:SetScaleX(1);
        element:SetScaleY(1);
        element:SetAngle(0);
        element:SetOpacity(1);
    
        effector = element:GetEffector();
        effector:SetLifeTime(0, 60);
        
        effector:SetKey(_TRACK_SX, 0, 1.1914618902439);
        effector:SetKey(_TRACK_SY, 0, 1.10770833333334);
        effector:SetKey(_TRACK_SX, 0.076904296875, 1.16448139157145);
        effector:SetKey(_TRACK_SY, 0.076904296875, 1.08072783466089);
        effector:SetKey(_TRACK_SX, 0.15384928385417, 1.20736050775542);
        effector:SetKey(_TRACK_SY, 0.15384928385417, 1.12360695084486);
        effector:SetKey(_TRACK_SX, 0.23075358072917, 1.17937747604669);
        effector:SetKey(_TRACK_SY, 0.23075358072917, 1.09562391913612);
        effector:SetKey(_TRACK_SX, 0.30769856770833, 1.17542410832917);
        effector:SetKey(_TRACK_SY, 0.30769856770833, 1.0916705514186);
        effector:SetKey(_TRACK_SX, 0.38460286458333, 1.17349869556633);
        effector:SetKey(_TRACK_SY, 0.38460286458333, 1.08974513865576);
        effector:SetKey(_TRACK_SX, 0.4615478515625, 1.19069099269454);
        effector:SetKey(_TRACK_SY, 0.4615478515625, 1.10693743578397);
        effector:SetKey(_TRACK_SX, 0.5384521484375, 1.20589653485586);
        effector:SetKey(_TRACK_SY, 0.5384521484375, 1.12214297794529);
        effector:SetKey(_TRACK_SX, 0.61539713541667, 1.22124856586266);
        effector:SetKey(_TRACK_SY, 0.61539713541667, 1.1374950089521);
        effector:SetKey(_TRACK_SX, 0.69230143229167, 1.19890993248152);
        effector:SetKey(_TRACK_SY, 0.69230143229167, 1.11515637557095);
        effector:SetKey(_TRACK_SX, 0.76924641927083, 1.19922030572289);
        effector:SetKey(_TRACK_SY, 0.76924641927083, 1.11546674881232);
        effector:SetKey(_TRACK_SX, 0.84615071614583, 1.1672628485251);
        effector:SetKey(_TRACK_SY, 0.84615071614583, 1.08350929161453);
        effector:SetKey(_TRACK_SX, 0.923095703125, 1.16184733901858);
        effector:SetKey(_TRACK_SY, 0.923095703125, 1.07809378210802);
        effector:SetKey(_TRACK_SX, 1, 1.21663416722989);
        effector:SetKey(_TRACK_SY, 1, 1.13288061031933);
        effector:SetKey(_TRACK_SX, 1.076904296875, 1.21183848865083);
        effector:SetKey(_TRACK_SY, 1.076904296875, 1.12808493174027);
        effector:SetKey(_TRACK_SX, 1.15384928385417, 1.20364701552238);
        effector:SetKey(_TRACK_SY, 1.15384928385417, 1.11989345861182);
        effector:SetKey(_TRACK_SX, 1.23075358072917, 1.21763212248976);
        effector:SetKey(_TRACK_SY, 1.23075358072917, 1.13387856557919);
        effector:SetKey(_TRACK_SX, 1.30769856770833, 1.20795836535606);
        effector:SetKey(_TRACK_SY, 1.30769856770833, 1.12420480844549);
        effector:SetKey(_TRACK_SX, 1.38460286458333, 1.18352494148448);
        effector:SetKey(_TRACK_SY, 1.38460286458333, 1.09977138457391);
        effector:SetKey(_TRACK_SX, 1.4615478515625, 1.16544180906466);
        effector:SetKey(_TRACK_SY, 1.4615478515625, 1.0816882521541);
        effector:SetKey(_TRACK_SX, 1.5384521484375, 1.20589378819);
        effector:SetKey(_TRACK_SY, 1.5384521484375, 1.12214023127944);
        effector:SetKey(_TRACK_SX, 1.61539713541667, 1.1757253260177);
        effector:SetKey(_TRACK_SY, 1.61539713541667, 1.09197176910713);
        effector:SetKey(_TRACK_SX, 1.69230143229167, 1.19751554178356);
        effector:SetKey(_TRACK_SY, 1.69230143229167, 1.11376198487299);
        effector:SetKey(_TRACK_SX, 1.76924641927083, 1.21180644421588);
        effector:SetKey(_TRACK_SY, 1.76924641927083, 1.12805288730532);
        effector:SetKey(_TRACK_SX, 1.84615071614583, 1.21754972251417);
        effector:SetKey(_TRACK_SY, 1.84615071614583, 1.13379616560361);
        effector:SetKey(_TRACK_SX, 1.923095703125, 1.21468495002966);
        effector:SetKey(_TRACK_SY, 1.923095703125, 1.1309313931191);
        effector:SetKey(_TRACK_SX, 2, 1.17056067865907);
        effector:SetKey(_TRACK_SY, 2, 1.08680712174851);
        effector:SetKey(_TRACK_SX, 2.076904296875, 1.21222302187023);
        effector:SetKey(_TRACK_SY, 2.076904296875, 1.12846946495967);
        effector:SetKey(_TRACK_SX, 2.15384928385417, 1.19713650189587);
        effector:SetKey(_TRACK_SY, 2.15384928385417, 1.1133829449853);
        effector:SetKey(_TRACK_SX, 2.23075358072917, 1.19758970176159);
        effector:SetKey(_TRACK_SY, 2.23075358072917, 1.11383614485102);
        effector:SetKey(_TRACK_SX, 2.30769856770833, 1.16424060053169);
        effector:SetKey(_TRACK_SY, 2.30769856770833, 1.08048704362112);
        effector:SetKey(_TRACK_SX, 2.38460286458333, 1.16993169217877);
        effector:SetKey(_TRACK_SY, 2.38460286458333, 1.08617813526821);
        effector:SetKey(_TRACK_SX, 2.4615478515625, 1.21191814196057);
        effector:SetKey(_TRACK_SY, 2.4615478515625, 1.12816458505);
        effector:SetKey(_TRACK_SX, 2.5384521484375, 1.21449543008581);
        effector:SetKey(_TRACK_SY, 2.5384521484375, 1.13074187317525);
        effector:SetKey(_TRACK_SX, 2.61539713541667, 1.19137949026831);
        effector:SetKey(_TRACK_SY, 2.61539713541667, 1.10762593335775);
        effector:SetKey(_TRACK_SX, 2.69230143229167, 1.19847046594506);
        effector:SetKey(_TRACK_SY, 2.69230143229167, 1.1147169090345);
        effector:SetKey(_TRACK_SX, 2.76924641927083, 1.16740567514945);
        effector:SetKey(_TRACK_SY, 2.76924641927083, 1.08365211823888);
        effector:SetKey(_TRACK_SX, 2.84615071614583, 1.16921023461476);
        effector:SetKey(_TRACK_SY, 2.84615071614583, 1.0854566777042);
        effector:SetKey(_TRACK_SX, 2.923095703125, 1.20184886494406);
        effector:SetKey(_TRACK_SY, 2.923095703125, 1.11809530803349);
        effector:SetKey(_TRACK_SX, 3, 1.18460621227521);
        effector:SetKey(_TRACK_SY, 3, 1.10085265536465);
        effector:SetKey(_TRACK_SX, 3.076904296875, 1.2053060016975);
        effector:SetKey(_TRACK_SY, 3.076904296875, 1.12155244478693);
        effector:SetKey(_TRACK_SX, 3.15384928385417, 1.19535666242323);
        effector:SetKey(_TRACK_SY, 3.15384928385417, 1.11160310551266);
        effector:SetKey(_TRACK_SX, 3.23075358072917, 1.16733426183727);
        effector:SetKey(_TRACK_SY, 3.23075358072917, 1.08358070492671);
        effector:SetKey(_TRACK_SX, 3.30769856770833, 1.18649317171611);
        effector:SetKey(_TRACK_SY, 3.30769856770833, 1.10273961480555);
        effector:SetKey(_TRACK_SX, 3.38460286458333, 1.17939761826294);
        effector:SetKey(_TRACK_SY, 3.38460286458333, 1.09564406135238);
        effector:SetKey(_TRACK_SX, 3.4615478515625, 1.19715755966741);
        effector:SetKey(_TRACK_SY, 3.4615478515625, 1.11340400275684);
        effector:SetKey(_TRACK_SX, 3.5384521484375, 1.19685908864473);
        effector:SetKey(_TRACK_SY, 3.5384521484375, 1.11310553173417);
        effector:SetKey(_TRACK_SX, 3.61539713541667, 1.18927737533561);
        effector:SetKey(_TRACK_SY, 3.61539713541667, 1.10552381842504);
        effector:SetKey(_TRACK_SX, 3.69230143229167, 1.21218548410358);
        effector:SetKey(_TRACK_SY, 3.69230143229167, 1.12843192719301);
        effector:SetKey(_TRACK_SX, 3.76924641927083, 1.1888818554528);
        effector:SetKey(_TRACK_SY, 3.76924641927083, 1.10512829854223);
        effector:SetKey(_TRACK_SX, 3.84615071614583, 1.16831390599145);
        effector:SetKey(_TRACK_SY, 3.84615071614583, 1.08456034908089);
        effector:SetKey(_TRACK_SX, 3.923095703125, 1.21418231017859);
        effector:SetKey(_TRACK_SY, 3.923095703125, 1.13042875326803);
        effector:SetKey(_TRACK_SX, 4, 1.20167857166118);
        effector:SetKey(_TRACK_SY, 4, 1.11792501475061);
        effector:SetKey(_TRACK_SX, 4.076904296875, 1.21144479987859);
        effector:SetKey(_TRACK_SY, 4.076904296875, 1.12769124296803);
        effector:SetKey(_TRACK_SX, 4.15384928385417, 1.18976994407855);
        effector:SetKey(_TRACK_SY, 4.15384928385417, 1.10601638716799);
        effector:SetKey(_TRACK_SX, 4.23075358072917, 1.19583458228162);
        effector:SetKey(_TRACK_SY, 4.23075358072917, 1.11208102537106);
        effector:SetKey(_TRACK_SX, 4.30769856770833, 1.18974339297531);
        effector:SetKey(_TRACK_SY, 4.30769856770833, 1.10598983606474);
        effector:SetKey(_TRACK_SX, 4.38460286458333, 1.20238354923007);
        effector:SetKey(_TRACK_SY, 4.38460286458333, 1.11862999231951);
        effector:SetKey(_TRACK_SX, 4.4615478515625, 1.17649256134592);
        effector:SetKey(_TRACK_SY, 4.4615478515625, 1.09273900443536);
        effector:SetKey(_TRACK_SX, 4.5384521484375, 1.16900057245466);
        effector:SetKey(_TRACK_SY, 4.5384521484375, 1.0852470155441);
        effector:SetKey(_TRACK_SX, 4.61539713541667, 1.19476887593072);
        effector:SetKey(_TRACK_SY, 4.61539713541667, 1.11101531902015);
        effector:SetKey(_TRACK_SX, 4.69230143229167, 1.18464466559715);
        effector:SetKey(_TRACK_SY, 4.69230143229167, 1.10089110868659);
        effector:SetKey(_TRACK_SX, 4.76924641927083, 1.17691463233198);
        effector:SetKey(_TRACK_SY, 4.76924641927083, 1.09316107542141);
        effector:SetKey(_TRACK_SX, 4.84615071614583, 1.19898409245954);
        effector:SetKey(_TRACK_SY, 4.84615071614583, 1.11523053554898);
        effector:SetKey(_TRACK_SX, 4.923095703125, 1.18160593760863);
        effector:SetKey(_TRACK_SY, 4.923095703125, 1.09785238069806);
        effector:SetKey(_TRACK_SX, 5, 1.1914618902439);
        effector:SetKey(_TRACK_SY, 5, 1.10770833333334);
    
    
        effector:Play();
    
        compositionMaskComp:Play();
    
        return compositionMaskComp;
    end
        
    local compos = createCompositionCredits();
    compos:GetEffector():SetKey(_TRACK_O, 0.0, 0.0)
    compos:GetEffector():SetKey(_TRACK_O, 0.5, 1.0)
    compos:GetEffector():Play();
    --compos:SetClippingRect(0, 0, CreditsSeparatorX, 768)
    return compos;

end

function OnSceneFree(screen)
    DefaultOnSceneFree()
    FreeData(screen)
end

function OnUpdate(dt)
    DefaultOnUpdate(dt)
end

function OnAllItemsFound()
    DefaultOnAllItemsFound()
end

function OnLose()
    DefaultOnLose()
end

function OnExit()
    DefaultOnExit()
end

function OnClose()
    DefaultOnClose()
end

function OnObjectMouseEnter(object)
    DefaultOnObjectMouseEnter(object)
end

function OnObjectMouseLeave(object)
    DefaultOnObjectMouseLeave(object)
end

function OnObjectMouseDown(object)
    local is_wrong_click = not DefaultOnObjectMouseDown(object)
    local obj_name = object:GetName()
    local pf = play_field

    DefaultOnObjectMouseDownProcessed(is_wrong_click);
end

function OnObjectMouseUp(object)
    DefaultOnObjectMouseUp(object)
end

function OnObjectFound(object)
    DefaultOnObjectFound(object)
end

function OnToolFound(tool)
    DefaultOnToolFound(tool)
end

function OnToolApply(tool, object)
    DefaultOnToolApply(tool, object)
end

function OnObjectReachPanel(object)
    DefaultOnObjectReachPanel(object)
end

function OnButtonPress(title)
    DefaultOnButtonPress(title)
end

function OnMouseMove(previous_pos, current_pos)
    DefaultOnMouseMove(previous_pos, current_pos)
end

function OnSetTool(tool)
    DefaultOnSetTool(tool)
end

function LevelLoaded(level)
end

function OnSceneDestroy(playfield)
    DefaultOnSceneDestroy(playfield)
end

--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData(screen)
	local anim = CreateAnimation('data/Texture/Scenes/40_Credits/field.jpg',0,0,1024,59,1,0)
	anim:SetHotSpot(512,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('field_top',anim,512,29,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/40_Credits/field.jpg',0,0,1024,59,1,0)
	anim:SetHotSpot(512,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('field_bottom',anim,512,738,100,0,1,1)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END
