Skip to content

Instantly share code, notes, and snippets.

@drhayes
Created February 15, 2018 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drhayes/93df3016e27c0bb8061173b373740cde to your computer and use it in GitHub Desktop.
Save drhayes/93df3016e27c0bb8061173b373740cde to your computer and use it in GitHub Desktop.
The onDead method from drone enemies
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