public override void onHit(Levels.Level l) { OffsetY -= 5; HitSound.Play(); if (HeldItem != null) { l.Items.Add(HeldItem); l.ParticleSystems.Add(new Particles.ParticleSystemCoin(Position.X, Position.Y)); coins--; if(coins == 0) HeldItem = null; } if(coins == 0) { SolidBlock temp = new SolidBlock(Position.X / 24, Position.Y / 24); temp.OffsetY -= 5; l.Blocks.Add(temp); this.destroy(l); } }
public override void onHit(Levels.Level l) { base.onHit(l); if (HeldItem != null) { if (HeldItem is ItemCoin) l.ParticleSystems.Add(new Particles.ParticleSystemCoin(Position.X, Position.Y)); l.Items.Add(HeldItem); HeldItem = null; } SolidBlock temp = new SolidBlock(Position.X / 24, Position.Y / 24); temp.OffsetY -= 5; l.Blocks.Add(temp); this.destroy(l); }