diff --git a/Shared/NPC.cs b/Shared/NPC.cs index 41c067d..a86c2ec 100644 --- a/Shared/NPC.cs +++ b/Shared/NPC.cs @@ -47,10 +47,12 @@ namespace SemiColinGames { } public class NPC { + // TODO: load sprite sizes from metadata. private const int spriteWidth = 96; - private const int spriteHeight = 81; - private const int spriteCenterYOffset = 10; - private readonly Vector2 eyeOffset = new Vector2(4, -3); + private const int spriteHeight = 82; + private const int groundPadding = 7; + private readonly Vector2 spriteCenter; + private readonly Vector2 eyeOffset = new Vector2(4, -9); private readonly FSM fsm; private AABB physicsBox; @@ -58,6 +60,7 @@ namespace SemiColinGames { public NPC(Point position, int facing) { Position = position; + spriteCenter = new Vector2(spriteWidth / 2, spriteHeight - halfSize.Y - groundPadding); physicsBox = new AABB(position.ToVector2(), halfSize); Facing = facing; fsm = new FSM(new Dictionary> { @@ -103,8 +106,6 @@ namespace SemiColinGames { public void Draw(SpriteBatch spriteBatch) { Rectangle textureSource = Sprites.Executioner.GetTextureSource( fsm.StateName, Clock.ModelTime.TotalSeconds); - // TODO: move this into Sprite metadata. - Vector2 spriteCenter = new Vector2(spriteWidth / 2, spriteHeight / 2 + spriteCenterYOffset); SpriteEffects effect = Facing == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Color color = Color.White;