Parallax Problems - Set Focus / Camera Issue - Lime

I’m trying to get Parallax working on my new side-scrolling project, but am having issues with getting the camera to focus. When parallax is enabled, the camera seems to be on a different layer or something – it no longer focuses correctly and follows the target object. Instead, it seems to hang around the screen width instead of the stage width.

I have the ParallaxEnabled set to true on the map settings, parallaxBase setting on the “Platforms” layer and have a parallaxFactorX value of .5 on the Background layer. Any help getting this to work would be really appreciated.

Thanks a lot,
Clay [import]uid: 62528 topic_id: 19858 reply_id: 319858[/import]

I’m now thinking this may have something to do with the xOffset variable in the map:setFocus function. Currently, I am not setting this value. Could you help me figure out how I’d compute it / if this might be related?

EDIT:

I take that back,the xOffset doesn’t seem to help. The camera’s bound width seems to only stretch about half the stage when it is focusing on an object. sliding works fine, however.

Thanks again,
Clay [import]uid: 62528 topic_id: 19858 reply_id: 77118[/import]

Does the ParallaxAndPlayer sample work as I think that uses the setFocus() stuff? [import]uid: 5833 topic_id: 19858 reply_id: 77336[/import]

Hey Graham,

The problem seems to be with the map:slideToPosition function. setFocus() works fine, but slideToPosition seems to not be locked to the parallaxBase layer or something.

It would be great if you could help me work this out – the parallax really looks beautiful and I’d love to include it in the first release of my upcoming game!

Thanks for the quick response and the help so far!

  • Clay [import]uid: 62528 topic_id: 19858 reply_id: 78602[/import]

I think the slideToPosition function is also demoed in the BasicParallax sample via tapping on the map. [import]uid: 5833 topic_id: 19858 reply_id: 78985[/import]

Hey Again,

Looking at that sample seems to have solved my parallax problem.

One more question regarding dragging the map (this happens with both parallax on and off):

  • I currently have a map that is 2x the width of the iPhone’s screen (similar setup to angry birds style camera). The dragging works fine and constrains to the proper bounds, but when the map is on the far left side (aka the origin, self.world.x = 0), If the user drags as if to scroll further left, the map will sometimes jump to the far right side of the world. This only happens after a drag which about half the screen width.

I hope I am being clear enough as to what is happening. Clearing this up would solve all my current camera issues.

Thanks again,
Clay [import]uid: 62528 topic_id: 19858 reply_id: 79015[/import]

If this is the issue I think it is I have seen it a couple of times before. As a test, try increasing your map size in Tiled by one column. [import]uid: 5833 topic_id: 19858 reply_id: 79276[/import]

Hey Graham,

Increasing my map’s size (width) by one column did not solve this issue. Any other ideas?

Thanks,
Clay [import]uid: 62528 topic_id: 19858 reply_id: 80186[/import]

If possible could you create a small demo project that reproduces the issue and sending it to support@justaddli.me or if you can’t do that then feel free to send your whole project. [import]uid: 5833 topic_id: 19858 reply_id: 80207[/import]

Hey Graham,

This bug also seems to appear in the “Basic Parallax” sample app, so you should have what you need.

Thanks a ton for your help.

  • Clay [import]uid: 62528 topic_id: 19858 reply_id: 80235[/import]

Ok cool thanks, will see what I can find. [import]uid: 5833 topic_id: 19858 reply_id: 80488[/import]

Hey Graham,

Any luck?

Thanks,
Clay [import]uid: 62528 topic_id: 19858 reply_id: 81985[/import]

Haven’t found a solution yet, still looking into it :slight_smile: [import]uid: 5833 topic_id: 19858 reply_id: 82837[/import]