public void Update(GameTime gameTime) { elapsedFrames += (float)gameTime.ElapsedGameTime.TotalSeconds * 60; if (elapsedFrames > 10) { switch (frame) { case MysteryBlockFrame.FirstFrame: frame = MysteryBlockFrame.Flash1; currentFrame = BlockSpriteFactory.MysteryBlock(frame); break; case MysteryBlockFrame.Flash1: frame = MysteryBlockFrame.Flash2; currentFrame = BlockSpriteFactory.MysteryBlock(frame); break; case MysteryBlockFrame.Flash2: frame = MysteryBlockFrame.FirstFrame; currentFrame = BlockSpriteFactory.MysteryBlock(frame); break; } elapsedFrames = 0; } }
public MysteryBlockSprite(int posX, int posY, MysteryBlockFrame frame) { Location = new Vector2(posX, posY); WidthHeight = new Vector2(BlockSpriteFactory.BLOCK_WIDTH, BlockSpriteFactory.BLOCK_HEIGHT); Boundary = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y); this.frame = frame; currentFrame = BlockSpriteFactory.MysteryBlock(frame); EntityType = TileMapInterpreter.Entities.QUESTION_COIN; }
public static Rectangle MysteryBlock(MysteryBlockFrame frame) { switch (frame) { case MysteryBlockFrame.FirstFrame: return(new Rectangle(BLOCK_WIDTH * 23, 0, BLOCK_WIDTH, BLOCK_HEIGHT)); case MysteryBlockFrame.Flash1: return(new Rectangle(BLOCK_WIDTH * 24, 0, BLOCK_WIDTH, BLOCK_HEIGHT)); case MysteryBlockFrame.Flash2: return(new Rectangle(BLOCK_WIDTH * 25, 0, BLOCK_WIDTH, BLOCK_HEIGHT)); default: return(new Rectangle()); } }