ParallaxNode with player inbetween

ParallaxNode with player inbetween
0

Hi friends…

It is time to use ParallaxNode for my game, according to the docs, it seems easy to setup, what i want to do is to make my player walk in middle of two layers:

------------------ Background layer ------------------- (moves slowly)
---------------------- Player ------------------------- (moves normal)
------------------ Foreground layer -------------------- (moves fastly)

can this be done ?.. if so, how should i set sprite layers?.. my player is currently in 0, background is set to -1 and foreground is 1, both layers are child of a ParallaxNode… Player is child of scene.

Of course Player is controlled by keyboard, and is not part of the Parallax node…

Thanks.

Why not add the player as a child of the ParallaxNode object with parallaxRatio of 1.0, and the other layers in front and behind with parallaxRatio > 1.0 and < 1.0.

If you want the player on a separate node (having a different parent than the ParallaxNode object), then you will have to break your ParallaxNode object up, and either use 2 (one in infront and one behind) or write your own logic for the relative motions of the background and foreground.

Cpp-tests has parallax node examples too.