CAMERA_TIME = 3.0 pFlipped = GetBoolParam("flipped", false) function init() local vaultCamera = FindLocation("vaultcamera") vaultDoor = FindBody("vaultdoor") vaultLock = FindJoint("vaultlock") cameraTransform = GetLocationTransform(vaultCamera) shapes = GetBodyShapes(vaultDoor) done = false doneTimer = 0 end function tick(dt) if not done then for i=1, #shapes do if IsShapeBroken(shapes[i]) then local inactiveRobots = FindBodies("inactive") for i=1, #inactiveRobots do RemoveTag(inactiveRobots[i], "inactive") end Delete(vaultLock) if pFlipped then SetBodyAngularVelocity(vaultDoor, Vec(0, 6, 0)) else SetBodyAngularVelocity(vaultDoor, Vec(0, -6, 0)) end SetBool("level.vaultbroken", true) done = true end end else doneTimer = doneTimer + dt if doneTimer < CAMERA_TIME then SetCameraTransform(cameraTransform) cameraTransform.pos = VecAdd(cameraTransform.pos, TransformToParentVec(cameraTransform, Vec(0, 0, -dt))) end end end function draw() if done and doneTimer < CAMERA_TIME then UiColor(0,0,0) UiRect(UiWidth(), 100) UiTranslate(0, UiHeight()-100) UiRect(UiWidth(), 100) end end