I have a PacMan clone I am making in XNA 4.0 that is tile-based. Everything is drawing in the correct position - except PacMan. It seems as if he is offset by 16 pixels on both x and y, but I don't know why.
Here is where I draw him:
public void Draw(SpriteBatch spriteBatch, int tileWidth, int tileHeight)
{
if (openMouth)
{
spriteBatch.Draw(pacMan1, new Rectangle(PosX * tileWidth, PosY * tileHeight,
tileWidth, tileHeight), null,
Color.White, MathHelper.ToRadians(Rotation), new Vector2(tileWidth / 2, tileHeight / 2),
SpriteEffects.None, 0f);
}
else
{
spriteBatch.Draw(pacMan2, new Rectangle(PosX * tileWidth, PosY * tileHeight,
tileWidth, tileHeight), null,
Color.White, MathHelper.ToRadians(Rotation), new Vector2(tileWidth / 2, tileHeight / 2),
SpriteEffects.None, 0f);
}
}
tileWidth and tileHeight are used for drawing the ghosts, and they show up fine, so it can't be them.
I tried posting this on App Hub,, but I can't since I'm only 13.
Thanks,
ge-force