Created
February 15, 2018 19:23
-
-
Save drhayes/93df3016e27c0bb8061173b373740cde to your computer and use it in GitHub Desktop.
The onDead method from drone enemies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function onDead(world, drone) | |
Signal.emit('enemyKilled', drone) | |
local viralAmount = (drone.health.damage.viral or 0) / drone.health.max | |
if viralAmount >= 0.5 then | |
drone.animation.currentName = 'dead' | |
drone.body.fx = 50 | |
drone.invoke = { | |
onInvoke = 'doLoot' | |
} | |
particles:viralSparks(drone) | |
world:addEntity(drone) | |
else | |
drone.removeMe = true | |
boom:small(util.entityMiddle(drone)) | |
end | |
Sound:droneHurt() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment