diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-13 11:55:28 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-13 11:55:28 +0800 |
| commit | c6e86ae57442b665d138bdb8bdbd2f7bbd9f5520 (patch) | |
| tree | 89fb10c7a3f4b558fa73399fa07327c0c4d66337 /objects/Enemy.lua | |
| parent | 7da9c57f410caec093156fd7c1da3c190643efcc (diff) | |
feat: pokobs drop a broken heart when a bullet hits them
also add a hook (onHit) to define behavior after a enemy is hit
Diffstat (limited to 'objects/Enemy.lua')
| -rw-r--r-- | objects/Enemy.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/objects/Enemy.lua b/objects/Enemy.lua index c80eb11..6bb3fce 100644 --- a/objects/Enemy.lua +++ b/objects/Enemy.lua @@ -133,6 +133,12 @@ function Enemy:getSticky(duration) self.sticky = duration end +function Enemy:onHit(shot) + if enemyData[self.type] and enemyData[self.type].onHit then + enemyData[self.type].onHit(shot) + end +end + function Enemy:update(dt) self:move(dt) self.frameTimer:update(dt) |
