public void UpdateAnimatedEntity(AnimatedEntity target, float timeDelta) { // Increase frameTime by last frame's delta target.frameTime = target.frameTime + timeDelta; // Test to see if the frameTime is greater than the frameDelay if (target.frameTime > target.frameDelay) { //Calculate next frame target.currentFrame = target.currentFrame + 1; if (target.currentFrame >= target.frames[target.currentState].Length) { target.currentFrame = 0; } // Increase start sprite target.spriteIDs = target.frames[target.currentState][target.currentFrame].spriteIDs; if (target.overlayFrames != null) { target.spriteOverlayIDs = target.overlayFrames[target.currentState][target.currentFrame].spriteIDs; } // Reset the frame target.frameTime = 0; } }
public void DrawAnimatedEntity(AnimatedEntity target) { if (target.spriteIDs != null) { DrawSprites(target.spriteIDs, target.x, target.y, target.w, false, false, DrawMode.Sprite, target.colorOffset, false, false); } if (target.spriteOverlayIDs != null) { DrawSprites(target.spriteOverlayIDs, target.x + target.overlayOffset.x, target.y + target.overlayOffset.y, target.overlayOffset.width, false, false, DrawMode.Sprite, target.colorOffset, false, false); } }