Correct way to use Farseer Physics in XNA
Posted
by
user1640602
on Game Development
See other posts from Game Development
or by user1640602
Published on 2012-09-08T14:12:30Z
Indexed on
2012/09/08
15:50 UTC
Read the original article
Hit count: 246
I am using Farseer Physics for my 2D sidescroller game and I'm not sure how to proceed with it. I currently have a Sprite class (handles nothing but graphics), a GameObject class (contains specific object info like hit points), a World object which contains the list of Bodies, and a Level object which contains all of these objects.
Originally I was trying to keep track of the Sprites, GameObjects, and Bodies separately because I felt that would provide loose coupling but it quickly became a headache.
So my new idea was to add a Sprite member to the GameObject class but I'm still not sure how to maintain the Bodies because they have to communicate with GameObject.
Specifically, my issue is this: The position of the Body is used to draw the Sprite inside of the Level. In order to do that I would have to maintain a link between GameObjects and Bodies. Is this correct or is there a better way to architect my game?
If any of this is unclear please ask and I'll try to clarify. Thank you in advance for any help.
© Game Development or respective owner