Object:remove()
Type: Function
Overview

Completely removes the object
Examples

Remove enemy on collision with player
local newAI = require('classes.SimpleAI').newAI
-- enemy instance
local enemy = newAI({group = mainGroup, img = "snailWalk1.png", x = 50, y = 500, ai_type = "patrol"}) 
-- change default ai functionality on visual contact with the player 
function enemy:defaultActionOnAiCollisionWithPlayer(event)
 enemy:remove() -- will remove enemy
end