Howdy.
I've got a parallax node (parr), with 3 layers in it, a background image, a tilemap, and then a foreground image.
* To pan the view/tilemap, I use [parr setPosition:position] (if I move using the camera, the parallax effect doesn't happen)
* To zoom, I'm changing the scale of the parallax node using [parr setScale:zoom].
The problem I'm having is when I change the scale, the position within the view/tilemap changes, and I don't appear to smart enough to figure out how to convert the current position to a new one when I change the scale (as newPosition != oldPosition * scale)
So how can I have a tilemap within a parallax node, when say, tile 16,20 in the middle of the screen, and change the zoom/scale, and still have 16,20 as the center tile?
Any pointers would be greatly appreciated... you know, on top of an ace framework as is.
-----
parr = [ParallaxNode node];
[parr addChild:background z:-1 parallaxRatio:ccp(1.0f,0.5f) positionOffset:CGPointZero];
[parr addChild:tilemap z:0 parallaxRatio:ccp(1.5f,1.0f) positionOffset:CGPointZero];
[parr addChild:foreground z:1 parallaxRatio:ccp(1.0f,1.0f) positionOffset:CGPointZero];
so when I:
[parr setScale:zoom];
how do I work out the correct co-ords for:
[parr setPosition:ccp(mapX, mapY)];