|#port, on draw zombie , needs, @draw zombie , reads, @zombie index| |#port body, on draw zombies, lua| local zombies = state.zombies love.graphics.setColor(0.145, 0.133, 0.169) love.graphics.circle("fill", zombie.x + 5, zombie.y + 5, zombie.r) love.graphics.setColor(0.882, 0.314, 0.282) love.graphics.circle("fill", zombie.x, zombie.y, zombie.r) love.graphics.setColor(1, 1, 1) |#port, on zombie track player , needs, @zombie track player , reads, @zombie index| |#port body, on zombie track player, lua| local player = state.player local zombie = state.zombies[zombie_index] zombie.angle = math.atan2(player.y - zombie.y, player.x - zombie.x) |#port, on move zombie , needs, @move zombie , reads, @zombie index| |#port body, on move zombie, lua| local zombie = state.zombes[zombie_index] zombie.x = zombie.x + state.dt * math.cos(zombie.angle) * 310 zombie.y = zombie.y + state.dt * math.sin(zombie.angle) * 310 |#port, on get zombie count, needs, @get zombie count| @zombie count |#port body, on get zombie count, lua| counters["@zombie count"] = #state.zombies |#port, on is zombie dead , needs, @is zombie dead , reads, @zombie index| @zombie is dead |#port body, on is zombie dead, lua| local zombie = state.zombies[zombie_index] counters["@zombie is dead"] = zombie.dead and 1 or 0