Type: Function
Overview
Describes the custom behavior on bullet collision with the player. The property object.allowShoot should be set to true.
Examples
Add custom functionality on bullet collision with the player
local newAI = require('classes.SimpleAI').newAI -- enemy instance local enemy = newAI({group = mainGroup, img = "snailWalk1.png", x = halfW-50, y = display.contentHeight-500, ai_type = "patrol"}) enemy.allowShoot = true -- the object now will fire periodically -- add custom functionality on bullet collision with the player function enemy:customActionOnAiFireToPlayer(event) print("I shot you " .. event.other.type) -- will print debug text in output end