Gleed2d farseer and parallax

Topics: Developer Forum
Jul 18, 2011 at 7:37 PM
Edited Jul 18, 2011 at 7:38 PM

Finally I got my objects working in farseer from glee2d.  Textures render too, but it seems farseer completely ignores the scrollspeed when i try to render the textures:

 

          foreach (Layer layer in level.Layers)
	  {
		Vector2 oldcameraposition = Camera.Position;
		Camera.Position *= layer.ScrollSpeed;
                ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Camera.View);
 		layer.draw(ScreenManager.SpriteBatch);
		ScreenManager.SpriteBatch.End();
		Camera.Position = oldcameraposition;
	}

 

It seems to maybe have something to do with how the Camera.View matrix acts.  Anyone been successful in getting a gleed2d level to load and scroll appropritaly?  basically I took the Camera2D object that came with the farseer samples and attached it to this sprite i can toss around with a mouse, the camera tracks well, glee2d rectangles work, and the textures too but things on a slower layer do not move any slower.

any ideas?

 

Jul 18, 2011 at 8:04 PM
Edited Jul 18, 2011 at 8:04 PM

I think that you don't have to move the camera since you should have only one that displays all the layers. Instead I think you have to move the layers using diferent speeds when the camera moves.

Jul 18, 2011 at 9:30 PM

hmm not 100% sure I know what you are saying here?  The GLeed2d demo does it above, but I realize my camera2d from farseer and glees are setup slightly differently.

Jul 19, 2011 at 10:09 AM

I don't know, I said it becouse that was the way I did it in Box2D in C++ some time ago. i supposed FPE was the same.