C#C
C#4y ago
Clara

❔ Removing items from a XAML window

I'm working on a small video game that I'm visualising with WPF.
The issue I have is that I can't quite figure out how to remove an entity from the window. For example, I have a little wizard, who shoots fireballs and I'd like those fireballs to disappear when the hit something.
MainWindow.worldEntityList.Remove(this)
hasn't really been doing the trick. I've tested a few things and can confirm that the fireballs are aware they've hit something (they deal damage to the enemies' healthbars), but I can't get rid of them. Or the enemies when they drop to 0hp, for that matter. Any clues you might be able to give me would be very much appreciated.
Was this page helpful?