summaryrefslogtreecommitdiff
path: root/objects/Shot.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-13 11:55:28 +0800
committerEltrac <hi@guhub.cn>2025-03-13 11:55:28 +0800
commitc6e86ae57442b665d138bdb8bdbd2f7bbd9f5520 (patch)
tree89fb10c7a3f4b558fa73399fa07327c0c4d66337 /objects/Shot.lua
parent7da9c57f410caec093156fd7c1da3c190643efcc (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/Shot.lua')
-rw-r--r--objects/Shot.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/objects/Shot.lua b/objects/Shot.lua
index 0e16f9f..67daa5f 100644
--- a/objects/Shot.lua
+++ b/objects/Shot.lua
@@ -42,6 +42,7 @@ function Shot:onContact(other, contact)
-- when contact with enemy, deal damage
if other.objectType == "enemy" then
other:takeDamage(self.damage)
+ other:onHit(self)
if bulletData[self.type] and bulletData[self.type].afterHit then
bulletData[self.type].afterHit(other.x, other.y, other.type)
end