If I understand you correctly Thats exactly what Im getting at, this is how Im calculating my passedFrames
double frametime = 1.0f / [SPStage mainStage].frameRate;
int passedFrames = floor((remainingTime + event.passedTime) / frametime);
remainingTime = fmod(remainingTime + event.passedTime, frametime);
So if 0.201 seconds passed between updates at 60fps the above calculation returns 12 passedframes with a remainder of 0.001 seconds to be passed onto the next update.
I was just making a feature request to add this calculation to SPStage and add the passedFrames property to SPEnterFrameEvent, so either passedTime or passedFrames could be used in Enterframe events, without having to add that calculation each time or create another event for example in SPStage
- (void)advanceTime:(double)seconds
{
// advance juggler
[mJuggler advanceTime:seconds];
double frametime = 1.0f / [SPStage mainStage].frameRate;
int passedFrames = floor((remainingTime + seconds) / frametime);
remainingTime = fmod(remainingTime + seconds, frametime);
// dispatch EnterFrameEvent
SPEnterFrameEvent *enterFrameEvent = [[SPEnterFrameEvent alloc]
initWithType:SP_EVENT_TYPE_ENTER_FRAME
passedTime:seconds
passedFrames:passedFrames];
[self broadcastEvent:enterFrameEvent];
[enterFrameEvent release];
}
Then it could be accessed like so
- (void) onEnterFrame:(SPEnterFrameEvent *)event
{
for(int i = 0; i < event.passedFrames; i++)
{
self.x += xVelocity;
self.y += yVelocity;
//perform collision detection ect
}
}