Add red tint hurt effect

This commit is contained in:
jordan4ibanez 2021-04-23 17:23:00 -04:00
parent 304cbed447
commit dc7592528c
1 changed files with 12 additions and 3 deletions

View File

@ -695,7 +695,14 @@ mobs.mob_step = function(self, dtime)
self.object:remove() self.object:remove()
return false return false
end end
--color mod which coincides with the pause_timer
if self.old_health and self.health < self.old_health then
self.object:set_texture_mod("^[colorize:red:120")
end
self.old_health = self.health
--do death logic (animation, poof, explosion, etc) --do death logic (animation, poof, explosion, etc)
if self.health <= 0 then if self.health <= 0 then
@ -724,8 +731,9 @@ mobs.mob_step = function(self, dtime)
if self.pause_timer > 0 then if self.pause_timer > 0 then
self.pause_timer = self.pause_timer - dtime self.pause_timer = self.pause_timer - dtime
--perfectly reset pause_timer --perfectly reset pause_timer
if self.pause_timer < 0 then if self.pause_timer <= 0 then
self.pause_timer = 0 self.pause_timer = 0
self.object:set_texture_mod("")
end end
end end
--this overrides internal lua collision detection --this overrides internal lua collision detection
@ -783,8 +791,9 @@ mobs.mob_step = function(self, dtime)
end end
--perfectly reset pause_timer --perfectly reset pause_timer
if self.pause_timer < 0 then if self.pause_timer <= 0 then
self.pause_timer = 0 self.pause_timer = 0
self.object:set_texture_mod("")
end end
--stop projectile mobs from being completely disabled while stunned --stop projectile mobs from being completely disabled while stunned