SSK2: Error when stopping camera

The easiest option would be to put a ‘pause’ flag in the camera and toggle it.

Then, have the enterFrame listener skip its work while paused.

"Good news.  I know how to do that.

Bad news.  I don’t have time to teach you or do it for you.

Sorry boss."

 

:(  

 

But, thanks for the tip, I will try it out! I think I have taken enough of your time up already.  :slight_smile:

**MAY CONTAIN TYPOS**

You could achieve this by creating your own module called camera_mod.lua with this in it:

-- camera\_mod.lua -- == -- tracking mode() - Follows target exactly. Added Pause -- == function ssk.camera.tracking\_mod( trackObj, world, params ) if( not isValid( trackObj ) ) then return end if( not isValid( world ) ) then return end params = params or {} local lockX = params.lockX local lockY = params.lockY local centered = fnn( params.centered, false) local lx = 0 local ly = 0 if( centered ) then if( lockX ) then lx = trackObj.x else lx = centerX end if( lockY ) then ly = trackObj.y else ly = centerY end else lx = params.lx or trackObj.x ly = params.ly or trackObj.y end world.enterFrame = function( event ) if( world.\_cameraPaused ) then return false end local dx = 0 local dy = 0 if(not lockX) then dx = trackObj.x - lx end if(not lockY) then dy = trackObj.y - ly end if(dx ~= 0 or dy ~= 0) then world:translate(-dx,-dy) lx = trackObj.x ly = trackObj.y end return false end listen( "enterFrame", world ) world.finalize = function( self ) ignoreList( { "enterFrame" }, self ) end; world:addEventListener( "finalize" ) function trackObj.pauseCamera( self ) if( isValid(world) ) then world.\_cameraPaused = true end end function trackObj.resumeCamera( self ) if( isValid(world) ) then world.\_cameraPaused = false end end function trackObj.stopCamera( self ) if( isValid(world) ) then ignoreList( {"enterFrame"}, world ) if( world.finalize ) then world:removeEventListener("finalize") world.finalize = nil end end end end

Then, require this after you load SSK2:

require "ssk2.loadSSK" \_G.ssk.init() require "camera\_mod"

Then change your code as follows:

function fixCamera() if( not anim.cameraAdded ) then anim.cameraAdded = true ssk.camera.tracking\_mod( anim, group, {lockY = true}) ) anim:pauseCamera() end if map.designedWidth - anim.x \< 1115 then anim:pauseCamera() elseif map.designedWidth - anim.x \> 1115 then anim:resumeCamera() end end

Elvis has left the building…

:lol:

Thank you very much! You didn’t even give me a chance to try it out.  :stuck_out_tongue:

I probably would have gotten stuck though.