So basically in a step command line I have this code
if BugType = 1 {
if instance_exists(Obj_Food_Small){
move_towards_point(Obj_Food_Small.x, Obj_Food_Small.y, 3)
}
} else {
move_towards_point(Obj_Ant_Home.x, Obj_Ant_Home.y, 3);
}
And I want it to test if there is a food object and if there is move towards the food which turns the bug type into 2 and then the ant will go back to the home, except the ant when created just moves to the right, where there isn't any food. Thanks if anyone can help.
You have one too many brackets. I've removed the extract bracket and formatted and changed the code. Instead of checking if BugType is 1 or 2 I recommend just assigning it 1 or 0 when there is food and if there isn't.
FROM THE DOCS:
So you can just check if BugType is true(0.5 or greater) or false(less than 0.5).