I have a basic RPG style project and server made with monogame and litenetlib respectively I noticed my sprite animations aren’t working when players are spawned from the serverPlayers list I have I’ve spent hours debugging this and it’s stuck in idle I’ve checked that content is loaded I’ve checked if it’s updating etc and it is I always get back the animation name for the button I pressed but the animation is stuck at idle I can fix that by just drawing the local player from the clientr but all server spawned players have the same issue so other players would look wrong player:
`
#region Movement Logic
float deltaX = 0;
float deltaY = 0;
Animation = “idle”;
// Handle movement input
if (InputManager.Instance.KeyDown(Keys.Up) || InputManager.Instance.KeyDown(Keys.W))
{
Animation = “walkUp”;
deltaY = -MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
CurDirection = (byte)Direction.Up;
}
else if (InputManager.Instance.KeyDown(Keys.Down) || InputManager.Instance.KeyDown(Keys.S))
{
Animation = “walkDown”;
deltaY = MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
CurDirection = (byte)Direction.Down;
}
if (InputManager.Instance.KeyDown(Keys.Right) || InputManager.Instance.KeyDown(Keys.D))
{
Animation = "walkRight";
deltaX = MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
CurDirection = (byte)Direction.Right;
}
else if (InputManager.Instance.KeyDown(Keys.Left) || InputManager.Instance.KeyDown(Keys.A))
{
Animation = "walkLeft";
deltaX = -MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
CurDirection = (byte)Direction.Left;
}
_playerSprite.Play(Animation);
// Set velocity based on input
Velocity = new Vector2(deltaX, deltaY);
// Update player position
if (Velocity != Vector2.Zero)
{
_playerSprite.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
Position += Velocity;
this.WorldPosition = Position;
}
}
Position += Velocity;
#endregion`
GamePlayScreen: for (int i = 0; i < GameClientHelpers.serverPlayer.Count; i++) { if (GameClientHelpers.serverPlayer[i]._playerSprite == null) { GameClientHelpers.serverPlayer[i].LoadContent(GameClientHelpers.serverPlayer[i].Name); } } for (int i = 0; i < GameClientHelpers.serverPlayer.Count; i++) { GameClientHelpers.serverPlayer[i].Update(gameTime); }
same style for draw but obviously with .Draw(spriteBatch)