Sprite se ralentiza con el tiempo después de cambiar a un estado de juego específico

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

How about if you don't ever switch from combat to exploration, but stay in exploration from the beginning (assuming that makes sense. It's pretty tough to diganose without deep understanding.) Also, if you switch back to combat does it "stop slowing down" or does it restore original speed? Sounds like a resource is being allocated without being freed suddenly; traversing an ever growing structure that should be frequently pruned or cleaned up, etc. -

1 Respuestas

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. -_-

respondido 10 mar '12, 23:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.