Type: Function
Overview
Switch object direction to reverse
Examples
Switch enemy direction to reverse, when enemy collision with another enemy object
local newAI = require('classes.SimpleAI').newAI -- enemy instance local enemy = newAI({group = mainGroup, img = "snailWalk1.png", x = halfW-140, y = display.contentHeight-500, ai_type = "patrol"}) enemy.withoutLimit = true -- allow AI go ahead without limit function enemy:customActionOnAiCollisionWithObjects(event) if(event.other.type == 'enemy') then enemy:SwitchDirection() -- switch enemy direction, when AI collision with another AI end end