public override void Update(GamePlay level, Mario mario) { this.lifetime++; if (this.IsCollision(mario.X, mario.Y)) { if (!mario.OnGround && mario.VY > 0) { this.RemoveMe = true; JukeBox.PlaySound("Clobber"); } else if (!mario.IsDead) { mario.IsDead = true; } } if (!mario.IsDead) { int proposedX = this.X + (this.goingLeft ? -2 : 2); Block b = level.GetBlockForPixel(proposedX, this.Y); if (b == null || b.IsPassable) { this.X = proposedX; } else { this.goingLeft = !this.goingLeft; } } }
public override void Update(GamePlay level, Mario mario) { this.lifetime++; if (this.lifetime == 1) { JukeBox.PlaySound("Coin"); //TODO: find a mushroom noise } if (this.IsCollision(mario.X, mario.Y)) { this.RemoveMe = true; Game.Instance.IsBig = true; JukeBox.PlaySound("Powerup"); } else if (this.lifetime > 16) { int proposedX = this.X + (this.headingRight ? 2 : -2); Block b = level.GetBlockForPixel(proposedX, this.Y); if (b == null || b.IsPassable) { this.X = proposedX; } else { this.headingRight = !this.headingRight; } } }