i’ve already made a post about this once, but the thread died so i’m gonna continue it. A message is passed to the slime script when the bullet collides with the slime. since the bullet continues to collide with the slime for an extended period of time, the result of the message passing, taking one from a health variable, triggers multiple times. i’ve tried implementing a time to live, but that results in the halting problem. a timer just delays the trigger.
bullet script
if message_id == hash("contact_point_response") then
go.delete()
end
if message_id == hash("sdeath") then
msg.post("slime#slime", "bk")
go.delete()
end
slime script
if message.group == hash("bullet") then
if not hash("bk") then
msg.post("player#bullet", "sdeath")
end
local damaged = true
--tiemr = 1
pprint("bullet collision")
if damaged == true then
pprint("health decreased")
self.health = self.health - dmg1
damaged = false
end
pprint("dmg is ", dmg1)
pprint("health is ",self.health)
end
end