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

Pathfinding Speed Interuption [Solved]

T

TyGamess

Guest
So! Path finding is a thing. Im using Grid Path Finding in my code. And as said the speed {var spd = 0} is set when you give the code {path_start(path, spd, path_action_stop, false)}
This defines the speed from point A to point B. But say between point A and B there is a river and to cross that river they need to swim. Thus they slow down to {spd = 0.2} yet when i tryed making this an opposing code, they still zoom through it. Is there any kind of interuption that can be placed once the path has started?

to also add, the obj_villager is moving from its current point to the point of another object {obj_target}
 

TheouAegis

Member
Loop through every point along the path, get the x and y coordinates, then check if there is water at that point. If so, set the speed, then set the previous point's speed for that point using path_change_point().
 

TheouAegis

Member
That's assuming it actually adds points like that. I haven't used the path finding functions since gm7. It was just a guess, to be honest.
 

vdweller

Member
Just change path_speed when on water. Instances following paths created with mp_grid_path have all the path variables properly in place.
 
Top