public ProjectileStarParticle(ContentManager Content, string spriteName, PixelUnit sourceX, PixelUnit sourceY, PixelUnit sourceWidth, PixelUnit sourceHeight, int fps, FrameUnit numFrames, GameUnit x, GameUnit y) : base(Content, spriteName, sourceX, sourceY, sourceWidth, sourceHeight, fps, numFrames, x, y) { }
public AnimatedSprite(ContentManager Content, string fileName, PixelUnit sourceX, PixelUnit sourceY, PixelUnit width, PixelUnit height, int fps, FrameUnit numberOfFrames) : base(Content, fileName, sourceX, sourceY, width, height) { frameTimer = new Timer(TimeSpan.FromMilliseconds(1000 / fps)); this.numberOfFrames = numberOfFrames; currentFrame = 0; numCompletedLoops = 0; }
public ImmobileSingleLoopParticle(ContentManager Content, string spriteName, PixelUnit sourceX, PixelUnit sourceY, PixelUnit sourceWidth, PixelUnit sourceHeight, int fps, FrameUnit numFrames, GameUnit x, GameUnit y) { this.x = x; this.y = y; sprite = new AnimatedSprite(Content, spriteName, sourceX, sourceY, sourceWidth, sourceHeight, fps, numFrames); }
public override void Update() { if (frameTimer.Expired) { currentFrame++; frameTimer.Reset(); if (currentFrame < numberOfFrames) { sourceRect.X += sourceRect.Width; } else { sourceRect.X -= sourceRect.Width * (numberOfFrames - 1); currentFrame = 0; numCompletedLoops++; } } }