in my game, i have the players made up of several bodies/geoms, so when they get shot up they can fall apart. for example, if one gets shot in the head enough, the neck joint will break and the head will fly off. however, it's not enough to just kill the
joints, because i need to be able to respawn the players without removing their dead body parts. so i made a (very) simple Entrails class and added the following code to my player class...
if (HeadGeom.ArbitraryFloat1 <= 0)
HeadGeom.CollisionGroup = 0;
HeadDeath = true;
Entrail e = new Entrail();
e.Body = HeadBody;
e.Flip = LookFlip;
e.Geom = HeadGeom;
e.Origin = HeadOrigin;
e.Sprite = HeadBox;
e.Added = false;
foreach(Entrail entrail in Entrails)
if (entrail.Added == false)
entrail.Added = true;
not exactly the cleanest code, i know.
basically, it creates an entrail object and sets the geom/body to that of the original head (as well as some other traits). the next part is sorta weird. i figured i needed to add the stuff to the physics engine AFTER i added the entrail to the entrails
list. this could be wrong.
anyways, this isn't working right and i can't quite figure out why. when the head gets shot off, the body/geom just seems to go away. the sprite hangs in midair. the only conclusion i can come to is that the entrail is not being added to the simulation,
but if "physicsSimulator.Add(entrail.Body);" doesn't work, then idk what's going on. could somebody give me a hand here?