I'm having a really weird issue with how my sprite moves. In my RPG game, whenever I switch to the combat game state from the exploration game state, my main character will gradually get slower, in both speed and animation. However, the enemies, which inherit from the same abstract class named Sprite which handles sprite drawing, will still move at their normal speeds. When switching to the exploration state to the pause state, which is handled in the same way the change form exploration to combat is, the game will not slow down. The game does not slow down when in the combat state.
Position is calculated using this Position += theDirection * theSpeed *(float)theGameTime.ElapsedGameTime.TotalSeconds;
The speed of the hero is a constant const int HERO_SPEED = 80;
I can post more code or explain more if necessary.
preguntado el 10 de marzo de 12 a las 00:03
Encontrado el problema
Turns out my groupmate was calling the hero player's update for every enemy. So for every enemy on the screen, it would call the hero's position update function and increment it. So as enemies were removed, the player moved slower. So silly. -_-