• 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!

(SOLVED)This is driving me nuts, could someone help please?

D

Den

Guest
So i'm trying to make a patrol path for an enemy. I have it follow a path and then stop at the end of it, when it's at the end point the path ends and an alarm is triggered in the "End Of Path" event, that just makes the enemy wait
for a random amount of seconds. The issue is I can not make the object go back up the path, I have literally been
trying loads of different path functions, playing around with path speed, playing around with path action functions
and I just can't get him to follow back up the path. Once the alarm ends I have the path start again, but I just don't
know how to make it go back up the path after stopping.
Is there a better way to set up a enemy patrol? or could someone please help out.
 
M

Mishtiff

Guest
First search I found looking in google with "game maker enemy pathing".
If this doesnt help, let me know and ill gladly help from here
 
D

Den

Guest
First search I found looking in google with "game maker enemy pathing".
This video just shows you how to make an object follow path, I already know how to do that lol I need to know how to make an enemy start again after I have stopped it at a certain point on the path
 
M

Mishtiff

Guest
I did not watch the video, only the end to see that the object is pathing both ways.

This seems pretty simple.
1. maintain a variable that saved which side of the path the object is on.
2. when it reaches the end, stop and set variable.
3. on restart, check variable, and write this:
Code:
if(pathPosition == 0){ //if at beginning
   path_start(path, speed, path_action_stop, absolute);
}
else{
   path_start(path, -(speed), path_action_stop, absolute); //the negative should make the unit walk in reverse along the path.
}
 
T

TimothyAllen

Guest
So i'm trying to make a patrol path for an enemy. I have it follow a path and then stop at the end of it, when it's at the end point the path ends and an alarm is triggered in the "End Of Path" event, that just makes the enemy wait
for a random amount of seconds. The issue is I can not make the object go back up the path, I have literally been
trying loads of different path functions, playing around with path speed, playing around with path action functions
and I just can't get him to follow back up the path. Once the alarm ends I have the path start again, but I just don't
know how to make it go back up the path after stopping.
Is there a better way to set up a enemy patrol? or could someone please help out.
I dont use paths much, but I think a simple solution that plays kindly with your set up would be:
Create
Code:
pathSpeed = 5; // or what ever you want;
// start your path using pathSpeed
// use the path_action_reverse as your end action
Alarm 0
Code:
path_speed = pathSpeed;
Path End Event
Code:
pathSpeed = path_speed;
path_speed = 0;
alarm[0] = room_speed; // or what ever you want your delay to be
 
Top