Type: Function
Overview
Describes the custom behavior of artificial intelligence on visual contact with objects, which will be added to the default (object:defaultActionOnVisualContactWithObjects(event)) functionality.
Examples
Add custom/additional ai functionality to the default functionality on visual contact with objects. For example, if necessary keep the basic functionality and add additional actions
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"}) -- add custom/additional ai functionality to the default functionality on visual contact with objects function enemy:customActionOnVisualContactWithObjects(event) print("You can not hide from me " .. event.other.type) -- will print debug text in output end