
local function enableHitbox(hitbox)
    hitbox.Collidable = true
end


--- go above player in 0.5
--- wait 0.1
--- dash down 0.25
--- wait 0.2
--- 8 pillars from middle for 1s
function onBegin()
    --log("Big Spike")
    setFlag("hk_change_to_no_head", true)
    
    playPuppetAnim("jump")
    local target = player.Position
    positionTween(target - vector2(0, 150), 0.5, false, true)
    wait(0.5)
    playPuppetAnim("dive")
    wait(speedYTweenTo(500, 0.25))
    while not puppet.Grounded do
        wait()
    end
    -- somehow start animation here ig?
    playPuppetAnim("diveL")
    wait(0.25)
	playSound("event:/CC/CC_HollowKnight/SFX/Boss SFX/THK_SwordsPrepare")
    for j = 0, 1 do
        for i = 0, 3 do 
            local attackOffset = vector2((j*2-1) * i * 40 + (j*10), -128+36)
            local attack = getNewBasicAttackEntity(puppet.Position + attackOffset, getHitbox(16, 128), "TheHollowKnightBurst", false)
            attack:Add(getEntityTimer(1.3))
            attack:Add(getEntityTimer(0.5, enableHitbox))
            addEntity(attack)
        end
    end
    wait(0.75)
	playSound("event:/CC/CC_HollowKnight/SFX/Boss SFX/THK_SwordsAppear")
	wait(0.25)
    playPuppetAnim("idle")
    setFlag("hk_change_to_main", true)
end