local xx = 460;
local yy = 550;
local xx2 = 920;
local yy2 = 550;
local ofs = 30;
local angleshit = 1;
local anglevar = 1;
local followchars = true;
function onCreate()
	-- background shit
	makeLuaSprite('Sky', 'Sky', -270, -300);
	setScrollFactor('Sky', 0.9, 0.9);
    scaleObject('Sky', 1.1, 1.1);

    makeLuaSprite('Mountains', 'Mountains', -270, -300);
	setScrollFactor('Mountains', 0.9, 0.9);
    scaleObject('Mountains', 1.1, 1.1);

    	makeLuaSprite('Ground', 'Ground', -280, 630);
	setScrollFactor('Ground', 0.9, 0.9);
	scaleObject('Ground', 1.1, 1.1);

    makeLuaSprite('fence', 'fence', -150, 100);
	setScrollFactor('fence', 0.9, 0.9);
    scaleObject('fence', 1.1, 1.1);
    	
    makeLuaSprite('Trashpile', 'Trashpile', -350, 20);
	setScrollFactor('Trashpile', 0.9, 0.9);
    scaleObject('Trashpile', 1.1, 1.1);

    makeLuaSprite('box', 'box', 1400, 500);
	setScrollFactor('box', 0.9, 0.9);
    scaleObject('box', 1.1, 1.1);

makeAnimatedLuaSprite('blue barrel','bluebarrel',1270, 330)
addAnimationByPrefix('blue barrel','dance','blue barrel',24,true)


makeAnimatedLuaSprite('red barrel','redbarrel',1300, 590)
addAnimationByPrefix('red barrel','dance','red barrel',24,true)

makeAnimatedLuaSprite('car','car', -490, 170)
addAnimationByPrefix('car','dance','car',24,true)


makeAnimatedLuaSprite('Tires2','tirepile', -300, 640)
addAnimationByPrefix('Tires2','dance','Tires2',24,true)

	
makeAnimatedLuaSprite('Tire','tire',930, 820)
addAnimationByPrefix('Tire','dance','Tire',24,true)


	addLuaSprite('Sky', false);
    addLuaSprite('Mountains', false);
	addLuaSprite('Ground', false);
    addLuaSprite('fence', false);
	addLuaSprite('Trashpile', false);
    addLuaSprite('blue barrel', false);
    addLuaSprite('box', false);
    addLuaSprite('red barrel', true);
    addLuaSprite('car', false);
    addLuaSprite('Tires2', true);
    addLuaSprite('Tire', true);
end

function onBeatHit()
objectPlayAnimation('blue barrel','dance',true)

objectPlayAnimation('red barrel','dance',true)

objectPlayAnimation('ca','dance',true)

objectPlayAnimation('Tires2','dance',true)

objectPlayAnimation('Tire','dance',true)

end

function onStepHit()

end

function opponentNoteHit()
    health = getProperty('health')
    if getProperty('health') > 0.1 then
        setProperty('health', health- 0.02);
    end
end

function onUpdate()
    if followchars == true then
        if mustHitSection == false then
            if getProperty('dad.animation.curAnim.name') == 'singLEFT' then
                triggerEvent('Camera Follow Pos',xx-ofs,yy)
            end
            if getProperty('dad.animation.curAnim.name') == 'singRIGHT' then
                triggerEvent('Camera Follow Pos',xx+ofs,yy)
            end
            if getProperty('dad.animation.curAnim.name') == 'singUP' then
                triggerEvent('Camera Follow Pos',xx,yy-ofs)
            end
            if getProperty('dad.animation.curAnim.name') == 'singDOWN' then
                triggerEvent('Camera Follow Pos',xx,yy+ofs)
            end
            if getProperty('dad.animation.curAnim.name') == 'singLEFT-alt' then
                triggerEvent('Camera Follow Pos',xx-ofs,yy)
            end
            if getProperty('dad.animation.curAnim.name') == 'singRIGHT-alt' then
                triggerEvent('Camera Follow Pos',xx+ofs,yy)
            end
            if getProperty('dad.animation.curAnim.name') == 'singUP-alt' then
                triggerEvent('Camera Follow Pos',xx,yy-ofs)
            end
            if getProperty('dad.animation.curAnim.name') == 'singDOWN-alt' then
                triggerEvent('Camera Follow Pos',xx,yy+ofs)
            end
            if getProperty('dad.animation.curAnim.name') == 'idle-alt' then
                triggerEvent('Camera Follow Pos',xx,yy)
            end
            if getProperty('dad.animation.curAnim.name') == 'idle' then
                triggerEvent('Camera Follow Pos',xx,yy)
            end
        else
            if getProperty('boyfriend.animation.curAnim.name') == 'singLEFT' then
                triggerEvent('Camera Follow Pos',xx2-ofs,yy2)
            end
            if getProperty('boyfriend.animation.curAnim.name') == 'singRIGHT' then
                triggerEvent('Camera Follow Pos',xx2+ofs,yy2)
            end
            if getProperty('boyfriend.animation.curAnim.name') == 'singUP' then
                triggerEvent('Camera Follow Pos',xx2,yy2-ofs)
            end
            if getProperty('boyfriend.animation.curAnim.name') == 'singDOWN' then
                triggerEvent('Camera Follow Pos',xx2,yy2+ofs)
            end
            if getProperty('boyfriend.animation.curAnim.name') == 'idle' then
                    triggerEvent('Camera Follow Pos',xx2,yy2)
            end
        end
    else
        triggerEvent('Camera Follow Pos','','')
    end
end