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

moving the player around - 2d game

Topics: Developer Forum, User Forum
Mar 3, 2012 at 5:34 PM


i'm beginner with farseer, i want some help to accomplish this :

i have a 2D game , no gravity , and a player, i want when i press the directional buttons (right - left - up - down) to make the player advance to that direction AND rotate to it , just like a car , it rotates to the desired direction while moving to it ..



Mar 3, 2012 at 9:51 PM

When you are trying the move your player with no gravity, you are going to want to use Body.ApplyForce() to move the player around. Then, you can calculate the rotation based on the direction it is moving.

Mar 4, 2012 at 3:58 PM

thank you jcicero09,

but if you can show me an example or how to use the  Body.ApplyForce() , and how to calculate rotation based on the direction it is moving..


Mar 4, 2012 at 5:30 PM
Edited Mar 4, 2012 at 5:34 PM

If you are making a car simulation this tutorial could be useful (made for the original Box2D in c++):

Some other great tutorials are found on this site (click on the tag Box2D  they are for the Flash port of Box2D):

Since those are not .NET/Farseer tutorials you might have some trouble if you don't read c++ or ActionScript but the concepts are exactly the same.