Assign an AI behavior to an entity.
The entity ID
AI behavior type: "chase", "patrol", or "flee"
Behavior options (target entity, speed, patrol points, max distance)
sg.setAI(enemy, 'chase', { target: player, speed: 100 });sg.setAI(guard, 'patrol', { points: [[100, 200], [300, 200]], speed: 60 }); Copy
sg.setAI(enemy, 'chase', { target: player, speed: 100 });sg.setAI(guard, 'patrol', { points: [[100, 200], [300, 200]], speed: 60 });
Assign an AI behavior to an entity.