local coroutineEntity = monocle.Entity()

local vector2 = require("#microsoft.xna.framework.vector2")

function onBegin(room)
  player.ForceCameraUpdate = true
  disableMovement()
  playSound("event:/avvi_starside/sfx_avvi1intro", player.Position)
  wait(0.75)
  setFlag("theIntroStarside0", True)
  wait(3)
  setFlag("starSideIntro1", True)
  wait(6)
  setFlag("starSideIntro3", True)
  setFlag("starSideIntroBlack", True)
  playSound("event:/avvi_starside/sfx_avvi1spaceShip", player.Position)
  wait(9)
  wait(2)
  setFlag("starSideIntroEnd1", True)
  wait(1.5)
  setFlag("starSideIntroEnd", True)
end

function onEnd(room, wasSkipped)
  player.DummyAutoAnimate = true
  player.ForceCameraUpdate = true
  getLevel():ResetZoom()
  enableMovement()
    if wasSkipped then
    setFlag("theIntroStarside0", True)
    setFlag("starSideIntro1", True)
    setFlag("starSideIntro3", True)
    setFlag("starSideIntroBlack", True)
    setFlag("starSideIntroEnd1", True)
    setFlag("starSideIntroEnd", True)
    player.DummyAutoAnimate = true
    player.ForceCameraUpdate = true
    getLevel():ResetZoom()
    end
end