function onBegin()
    local room = getRoom()
    player.ForceCameraUpdate = true
	room.PauseLock = true
    disableRetry()
    disableMovement()
  if not getFlag("hs_entrance_done") then
    setFlag("ehsApproach", false)
    wait(0.3)

    walkTo(1150)
    setFlag("hs_entrance1", true)
    shake()
    wait(0.7)

    walkTo(1172)
    setFlag("hs_entrance2", true)
    shake()
    wait(0.55)

    setFlag("hs_entrance3", true)
    playSound("event:/sj21/sfx/heartside_entrance_rock")
    wait(0.040)
    shake({0.0, 2.0}, 0.75)
    wait(0.16)

    setFlag("hs_entrance4", true)
    wait(0.5)

    setFlag("hs_entrance5", true)
    wait(0.56)

    setFlag("hs_blackout", true)
    wait(1.2)

    setFlag("hs_entrance8", true)
    setCameraOffset(0, 2)
    teleportTo(1060, 232)
    setPlayerState(20)
    setFlag("hs_entrance6", true)
    wait(0.1)

    setFlag("hs_blackout", false)
    waitUntilOnGround()
    wait(1)

    endCutscene()
  end
end

function onEnd()
    setFlag("hs_entrance7", true)
    setFlag("hs_entrance1", false)
    setFlag("hs_entrance2", false)
    setFlag("hs_entrance3", false)
    setFlag("hs_entrance4", false)
    setFlag("hs_entrance5", false)
    setFlag("hs_entrance6", false)
    setFlag("hs_entrance8", false)
	setFlag("hs_entrance_done", true)
	getRoom().PauseLock = false
	enableRetry()
    enableMovement()
end