public void Update(GameTime gameTime) { if (WasHit) { if (elapsedFrames > 5) { WasHit = false; elapsedFrames = 0; } } if (!isDead) { elapsedFrames += (float)gameTime.ElapsedGameTime.TotalSeconds * 60; if (elapsedFrames > 5 && elapsedFrames < 10) { goombaFrame = GoombaSpriteFactory.Goomba(GoombaColor.Red, GoombaFrame.ContinueWalk); } else if (elapsedFrames > 10) { goombaFrame = GoombaSpriteFactory.Goomba(GoombaColor.Red, GoombaFrame.StartWalk); elapsedFrames = 0; } } else { goombaFrame = GoombaSpriteFactory.Goomba(GoombaColor.Red, GoombaFrame.Dead); } }
public RedGoombaSprite(int posX, int posY, bool isDead) { this.isDead = isDead; Location = new Vector2(posX, posY); WidthHeight = new Vector2(GoombaSpriteFactory.GOOMBA_WIDTH, GoombaSpriteFactory.GOOMBA_HEIGHT); Boundary = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y); goombaFrame = GoombaSpriteFactory.Goomba(GoombaColor.Red, GoombaFrame.StartWalk); EntityType = TileMapInterpreter.Entities.GOOMBA; }