Allow easy killing (with animation) of anything that has a DR. Useful for plausibly disposing of projectiles.

This commit is contained in:
stevenhowes
2022-03-27 17:13:18 +01:00
parent 428e2d175c
commit 61b8cecc0b
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -25,6 +25,9 @@ func (dr *damageReceiver) onDraw() error {
} }
func (dr *damageReceiver) onUpdate() error { func (dr *damageReceiver) onUpdate() error {
if dr.container.Kill {
dr.health = -1
}
// If we're out of health // If we're out of health
if dr.health <= 0 { if dr.health <= 0 {
// If we have an animator, run the destroy sequence // If we have an animator, run the destroy sequence
+1
View File
@@ -21,6 +21,7 @@ type Element struct {
Rotation float64 Rotation float64
Active bool Active bool
Delete bool Delete bool
Kill bool
Collisions []Circle Collisions []Circle
components []component components []component
parentElement *Element parentElement *Element