This project has moved. For the latest updates, please go here.

Another beginner needing help getting started.

Topics: User Forum
Oct 4, 2009 at 9:39 PM
Edited Oct 4, 2009 at 9:44 PM

I have been programming with C# about 4 months & XNA about a month. I have been able to modify the platform tutorial with pretty decent results. However, I have dumped the tutorial code and started from scratch on a new game (just for my own education of XNA). I would like to in the future institute a swinging rope, a moving platform, and some simple physics. I am not good enough at this point to code those collisions and physics out of my head (other than simple gravity and inertia). I thought that starting out from the beginning with Farseer handling those for me would be a good approach. I have built a barebones platformer with simple movement and gravity on a tile map (See screenshot). My question is, and I know this is a complete noob question, but can someone give me a step by step approach (pseudocode) on how to integrate Farseer into my code, to attach to my player that will give him the gravity and collision response with the tiles. I am just looking for a starting point to start working with. The swinging rope and moving platforms will of course come much later.

Thanks in advance for any help I can get.


Oct 4, 2009 at 10:30 PM

First of all, you need to think simplicity. Getting physics to work is really simple with Farseer Physics. You basically just need a PhysicsSimulator, a Body, and a Geom.

The PhysicsSimulator handles all the dynamics on the bodies and the collisions on the geometries. To setup some simple samples, you could take a look here. Out manual also describes the different parts of the engine.

Oct 4, 2009 at 10:40 PM
Edited Oct 5, 2009 at 12:23 AM

Thank you for your guidance, I will explore the info you gave me and will continue to work on it. Once I get simple gravity, friction, & inertia working with my sprite, I'm sure there will be more questions to come.


UPDATE: Using the manual & the quickstart sample, it took less than 30 mins to apply gravity and inertia to control my player sprite (including my jump loop). Can't wait to dive into this some more. With a little time invested, I may actually get somewhere with my platformer. Thank you for pointing me in the right direction.