
local stopMoving = false;
local BGX = -900
local BGY = -300
local SCX = 1
local SCY = 1

function onCreate()
	setProperty('skipCountdown', true);
	
    makeLuaSprite('bg', 'RTX/needlemouse/sky', BGX, BGY);
	setScrollFactor('bg', 1,1);
	scaleObject('bg',SCX,SCY );
	addLuaSprite('bg', false);

    makeLuaSprite('mountains', 'RTX/needlemouse/mountains', BGX, BGY);
	setScrollFactor('mountains', 1,1);
	scaleObject('mountains',SCX,SCY );
	addLuaSprite('mountains', false);

    makeLuaSprite('BD', 'RTX/needlemouse/buildings', BGX, BGY);
	setScrollFactor('BD', 1,1);
	scaleObject('BD',SCX,SCY );
	addLuaSprite('BD', false);

    makeLuaSprite('GR', 'RTX/needlemouse/CONK_CREET', BGX, BGY);
	setScrollFactor('GR', 1,1);
	scaleObject('GR',SCX,SCY );
	addLuaSprite('GR', false);

    makeLuaSprite('GR1', 'RTX/needlemouse/Fire', BGX, BGY);
	setScrollFactor('GR1', 1,1);
	scaleObject('GR1',SCX,SCY );
	addLuaSprite('GR1', true);

    makeLuaSprite('ruins', 'RTX/needlemouse/ruins', BGX, BGY);
	setScrollFactor('ruins', 1,1);
	scaleObject('ruins',SCX,SCY);
	addLuaSprite('ruins', false);

    makeLuaSprite('ShBF', 'ShadowF', 770, 660);
	setScrollFactor('ShBF', 1,1);
	scaleObject('ShBF',0.52,0.52 );
	addLuaSprite('ShBF', false);

    makeLuaSprite('ShDAD', 'ShadowF', -100, 590);
	setScrollFactor('ShDAD', 1,1);
	scaleObject('ShDAD',0.6,0.6 );
	addLuaSprite('ShDAD', false);

    makeLuaSprite('ShGF', 'ShadowF', 1180, 610);
	setScrollFactor('ShGF', 1,1);
	scaleObject('ShGF',0.5,0.5 );
	addLuaSprite('ShGF', false);

    makeLuaSprite('ShDD', 'ShadowF', 100, 600);
	setScrollFactor('ShDD', 1,1);
	scaleObject('ShDD',0.5,0.5 );
	addLuaSprite('ShDD', false);
    setProperty('ShDD.visible', false)

    makeLuaSprite('Sh', 'Shadow', 0, 100);
	setScrollFactor('Sh', 2,2);
	addLuaSprite('Sh', true);
    setObjectCamera('Sh', 'hud')

    makeLuaSprite('Sh1', 'Shadow', 0, 100);
	setScrollFactor('Sh1', 2,2);
	addLuaSprite('Sh1', true);
    setObjectCamera('Sh1', 'hud')

    makeAnimatedLuaSprite('GF-needle', 'RTX/needlemouse/GF__Needlemouse', 1100, 300);
    addAnimationByPrefix('GF-needle', 'idle', 'GF_Normal', 24, true);
    addAnimationByPrefix('GF-needle', 'idle-scared', 'GF_Scared', 24, true);
    addLuaSprite('GF-needle', false);

	makeLuaSprite('black', 'black', 0, 0)
    addLuaSprite('black', true)
    setObjectCamera('black', 'hud')

	makeLuaSprite('intro', 'intro', 0, 60)
    addLuaSprite('intro', true)
    setObjectCamera('intro', 'hud')
	scaleObject('intro', 0.7, 0.7)
    doTweenAlpha('intro', 'intro', 0, 0.0001, 'linear')

	makeLuaSprite('gabmissingalt', 'gabmissingalt', 380, 130)
	addLuaSprite('gabmissingalt', true)
    setObjectCamera('gabmissingalt', 'hud')
	scaleObject('gabmissingalt', 0.8, 0.8)
	doTweenAlpha('gabmissingalt', 'gabmissingalt', 0, 0.0001, 'linear')

	makeLuaSprite('gabmissing', 'gabmissing', 380, 130)
	addLuaSprite('gabmissing', true)
    setObjectCamera('gabmissing', 'hud')
	scaleObject('gabmissing', 0.8, 0.8)
	doTweenAlpha('gabmissing', 'gabmissing', 0, 0.0001, 'linear')
end

function onStepHit()
	if curStep == 16 then
    setProperty('black.visible', false)
	doTweenAlpha('intro', 'intro', 0, 0.0001, 'linear')
	setProperty('healthBar.visible', true)
	setProperty('healthBarBG.visible', true)
	setProperty('iconP1.visible', true)
	setProperty('iconP2.visible', true)
	setProperty('scoreTxt.visible', true)
	setProperty('timeBar.visible', true)
	setProperty('timeBarBG.visible', true)
	setProperty('timeTxt.visible', true)
	for i = 0,7 do
	setPropertyFromGroup('strumLineNotes', i, 'alpha', 1)
	end
    end
    if curStep == 784 then
	doTweenAlpha('gabmissing', 'gabmissing', 1, 0.0001, 'linear')
	setProperty('black.visible', true)
	setProperty('healthBar.visible', false)
	setProperty('healthBarBG.visible', false)
	setProperty('iconP1.visible', false)
	setProperty('iconP2.visible', false)
	setProperty('scoreTxt.visible', false)
	setProperty('timeBar.visible', false)
	setProperty('timeBarBG.visible', false)
	setProperty('timeTxt.visible', false)
	for i = 0,7 do
	setPropertyFromGroup('strumLineNotes', i, 'alpha', 0)
	end
    end
	if curStep == 796 then
	doTweenAlpha('gabmissingalt', 'gabmissingalt', 1, 0.7, 'linear')
	doTweenAlpha('gabmissing', 'gabmissing', 0, 0.7, 'linear')
	end
    if curStep == 800 then
	doTweenAlpha('gabmissingalt', 'gabmissingalt', 0, 0.0001, 'linear')
    objectPlayAnimation('GF-needle', 'idle-scared');
	setProperty('black.visible', false)
	setProperty('healthBar.visible', true)
	setProperty('healthBarBG.visible', true)
	setProperty('iconP1.visible', true)
	setProperty('iconP2.visible', true)
	setProperty('scoreTxt.visible', true)
	setProperty('timeBar.visible', true)
	setProperty('timeBarBG.visible', true)
	setProperty('timeTxt.visible', true)
	for i = 0,7 do
	setPropertyFromGroup('strumLineNotes', i, 'alpha', 1)
	end
    end
end

function onSongStart()
    doTweenAlpha('intro', 'intro', 0.15, 2, 'linear')
	setProperty('healthBar.visible', false)
	setProperty('healthBarBG.visible', false)
	setProperty('iconP1.visible', false)
	setProperty('iconP2.visible', false)
	setProperty('scoreTxt.visible', false)
	setProperty('timeBar.visible', false)
	setProperty('timeBarBG.visible', false)
	setProperty('timeTxt.visible', false)
	for i = 0,7 do
	setPropertyFromGroup('strumLineNotes', i, 'alpha', 0)
	end
end

function onGameOver()
	stopMoving = true;
end
