public FireFlowerSprite(int positionX, int positionY, FireFlowerFrame fireFlowerFrame) { Location = new Vector2(positionX, positionY); WidthHeight = new Vector2(ItemSpriteFactory.ITEM_WIDTH, ItemSpriteFactory.ITEM_HEIGHT); Boundary = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y); frame = fireFlowerFrame; currentFrame = ItemSpriteFactory.FireFlower(frame); EntityType = TileMapInterpreter.Entities.FLOWER; }
public void Update(GameTime gameTime) { elapsedFrames += (float)gameTime.ElapsedGameTime.TotalSeconds * 60; if (WasHit) { if (elapsedFrames > 5) { WasHit = false; elapsedFrames = 0; } } if (elapsedFrames > 5 && frame == FireFlowerFrame.FirstFrame) { frame = FireFlowerFrame.Flash1; currentFrame = ItemSpriteFactory.FireFlower(frame); elapsedFrames = 0; } else if (elapsedFrames > 5 && frame == FireFlowerFrame.Flash1) { frame = FireFlowerFrame.Flash2; currentFrame = ItemSpriteFactory.FireFlower(frame); elapsedFrames = 0; } else if (elapsedFrames > 5 && frame == FireFlowerFrame.Flash2) { frame = FireFlowerFrame.Flash3; currentFrame = ItemSpriteFactory.FireFlower(frame); elapsedFrames = 0; } else if (elapsedFrames > 5 && frame == FireFlowerFrame.Flash3) { frame = FireFlowerFrame.FirstFrame; currentFrame = ItemSpriteFactory.FireFlower(frame); elapsedFrames = 0; } }