Also, if you are using a timer to time everything, I came across this
problem (So to speak) if you use SwinGame.Timer... basically, since it records how much time has passed since it started, and you have lots of objects that are being drawn and are moving, the time it takes to draw them does have an impact on the time, so later objects in the draw queue are going to move further than an object at the start. Therefore, you would pause the timer before you start drawing the objects so that they move to the same time frame.
So, something like this (Assume that this is in a loop, and all that I am doing is setting the objects new movement speed.:
- Code: Select all
SwinGame.Core.StopTimer(_timer);
SwinGame.Core.StartTimer(_timer);
// The move speed.
int moveSpd = 100; // Per second.
// Basically saying that I have 1000 objects to draw and move.
for(int i = 0; i < 1000; i++) {
// Calculate new movement speed.
_objArr[i] = moveSpd * (SwinGame.Core.GetTimerTicks(_timer) / 1000);
}
The problem with this is that if I have alot of complex calcluation which takes up 0.5 milliseconds, when I get to the last one, there will be a noticeable speed difference between the first and the last one. So a way of making it work would be to do something like this (I think).
- Code: Select all
SwinGame.Core.StopTimer(_timer);
SwinGame.Core.StartTimer(_timer);
// The move speed.
int moveSpd = 100; // Per second.
// Basically saying that I have 1000 objects to draw and move.
SwinGame.Core.PauseTimer(_timer);
for(int i = 0; i < 1000; i++) {
// Calculate new movement speed.
_objArr[i] = moveSpd * (SwinGame.Core.GetTimerTicks(_timer) / 1000);
}
SwinGame.Core.UnpauseTimer(_timer);
That way, the difference is gone and they all move with respect to a constant timer speed, but I'm not sure if this is how you would go about it. But I think it is the right way.