KeepTrackOfReal
Introduction
Code Example
Sprite parentSprite = SpriteManager.AddSprite("redball.bmp");
parentSprite.RotationZVelocity = 1;
Sprite childSprite = SpriteManager.AddSprite("redball.bmp");
childSprite.X = 3;
childSprite.AttachTo(parentSprite, true);
childSprite.KeepTrackOfReal = true;
childSprite.CustomBehavior += CreateNewSpriteEachFrame;void CreateNewSpriteEachFrame(Sprite sprite)
{
if (sprite.RealVelocity.X != 0 || sprite.RealVelocity.Y != 0)
{
Sprite newSprite = SpriteManager.AddParticleSprite(sprite.Texture);
newSprite.Velocity = sprite.RealVelocity;
newSprite.Position = sprite.Position;
newSprite.CustomBehavior +=
FlatRedBall.Utilities.CustomBehaviorFunctions.RemoveWhenOutsideOfScreen;
}
}Last updated
Was this helpful?
