Desperate need of help

Apr 10, 2010 at 11:35 AM

 

Hi everyone,
I'm in process of finishing my final project of my degree, a game. As a brief introduction, it is a 2D platform game performed in XNA (obviously). Moreover, I'm using the Farseer Engine for the physics.
I know that maybe this is not the best forum for asking for help about this kind of problems, but like is said in the discussion name, i' desperate...
Well, i have a big problem creating enemies. I have my world, containing a list of enemies. Each enemy has, inbetween other properties, a body, a geom, a direction, the velocity... But, when I'm updating those enemies, if one enemy changes the direction, the other do the same.
I've tried almost everything that came to my mind: cloning the enemies instances, using a deep clone method, i have my destructor in the class... but nothing is working.
Any help would be perfect, because I'm totally stuck...
Thanks.

 

 

Apr 10, 2010 at 6:35 PM

Could you give us a sample of your code?

It seems like somehow, you're making all the instances

of your enemies share one body 

 

-Oranjoose

Apr 11, 2010 at 6:51 PM

I had a bug similar to that hide from me, which turned out to be based on rapid calls to Random.Next().  (Cycling through a few random generators instead of one ended up resolving.  Also, interestingly, the lower processor speed on the xbox made this a PC-only issue.)  I'm guessing this isn't what's causing your trouble, but thought I'd share.

Oranjoose's guess sounds possible.  It's also possible the problem is that you're inadvertently giving the command to change direction to all the enemies.  Anyway, we can't do more than guess without code to look at.