• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Pathfinding doesn't work.

B

Bokkie2988

Guest
Hello,
So I've created a boss which should follow a infinity symbol like form. I used this code:
(In step event)
Code:
if (pathfollowing == true){
    path_start(pathboss1,2,path_action_continue,true);
}
Now I know it should be in the create event, otherwise it will warp itself back to the start position, which happens when I run the game.
But I want to change if the boss should follow the path later, Which you really only can do in step event. How do I fix this so it can be in the step event and also works?
Thanks,

-Bokkie
 
P

Poddington

Guest
You can use a switch or if statement that triggers the pathfinding once it's met. For example you have pathfollowing == true in the create event so you could turn this variable to false once it starts.
Code:
pathfollowing == true;
if (pathfollowing == true){
    path_start(pathboss1,2,path_action_continue,true);
    pathfollowing == false;
}
The path will probably have be checked again or changed, but the point above is purely so if you change the state to something else you can then restart it by changing pathfollowing back to true.
 
Top