public StarmanSprite(int positionX, int positionY, StarmanFrame starmanFrame) { 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 = starmanFrame; currentFrame = ItemSpriteFactory.Starman(frame); EntityType = TileMapInterpreter.Entities.STAR; IsBounded = false; }
public void Update(GameTime gameTime) { elapsedFrames += (float)gameTime.ElapsedGameTime.TotalSeconds * 60; if (WasHit) { if (elapsedFrames > 5) { WasHit = false; elapsedFrames = 0; } } if (elapsedFrames > 5 && frame == StarmanFrame.FirstFrame) { frame = StarmanFrame.Flash1; currentFrame = ItemSpriteFactory.Starman(frame); elapsedFrames = 0; } else if (elapsedFrames > 5 && frame == StarmanFrame.Flash1) { frame = StarmanFrame.Flash2; currentFrame = ItemSpriteFactory.Starman(frame); elapsedFrames = 0; } else if (elapsedFrames > 5 && frame == StarmanFrame.Flash2) { frame = StarmanFrame.Flash3; currentFrame = ItemSpriteFactory.Starman(frame); elapsedFrames = 0; } else if (elapsedFrames > 5 && frame == StarmanFrame.Flash3) { frame = StarmanFrame.FirstFrame; currentFrame = ItemSpriteFactory.Starman(frame); elapsedFrames = 0; } }