I want to make camera moves according to main hero. I watched Scroller and Potty Bird examples.
I set Parallax Enabled and Parallax Infinite to true in my Level. I put camera object. In my main.lua file i tried this:
camera = myLevel:getLayerObject("Camera","camera\_1") myLevel:slideCameraToPosition(200, 200, 200, easing.inOutQuad, onScrollFinished) \<\<--- nothing happened myLevel:move( 400, 0 ) \<\<----- nothing happened: screen doesn't change. Everything stay at the same positions. I thought whole screen will move to 400px to the left
I know this code isn’t enough to track hero but I wanted to try this camera object and move function.
Is there some option what I should set or something?
You also need to enable the tracking as it is not enabled by default;
myLevel:trackEnabled(true)
If you look in the scroller2 demo it doesn’t enabled tracking initially because it uses the slideCamera function which will not work correctly if it is tied to an object.
In the onScrollFinished2 function you’ll see once the level scrolling preview has finished it then enables the tracking.
You also need to enable the tracking as it is not enabled by default;
myLevel:trackEnabled(true)
If you look in the scroller2 demo it doesn’t enabled tracking initially because it uses the slideCamera function which will not work correctly if it is tied to an object.
In the onScrollFinished2 function you’ll see once the level scrolling preview has finished it then enables the tracking.