Hello, my game is doing some weird stuff now after I implemented my new class. I needed control of the head for the analog stick so I had to separate it into two separate textures. From there I gave a general position with a Vector2 that is assigned the
world position determined by my squareBody. Once I have that, I just offset the characters textures to make it look normal. The thing is, the graphic trails behing the Physics Body. I don't understand it at all really. Maybe I'm just not setting the position
very efficiently? Anyways here is what it looks like:
And the most obvious is here:
Any help would be great to this problem.
public void Update(Vector2 physicsPosition, float rotation)
position = physicsPosition;
head.Position = new Vector2(headPosition.X + (float)Math.Cos(rotation), headPosition.Y + (float)Math.Sin(rotation)) + physicsPosition;
body.Position = new Vector2(bodyPosition.X + (float)Math.Cos(rotation), bodyPosition.Y + (float)Math.Sin(rotation)) + physicsPosition;
head.Rotation = rotation;
body.Rotation = rotation;
This is how it looks right now. head and body are special classes that hold all of the parameters for the spriteBatch. physicsPosition is the position the geom is currently at (and my Math.Cos and other stuff may be wrong but I don't know for sure since
I have no angles at all yet in my code). position is saved for the public property Position and allows setting and retrieving of what it stores.
Any help would be great, thanks!