roymakesgames roymakesgames - 1 month ago
131 0

No description

Other

Pathfinding

Embed
if (point_distance(x, y, pathX, pathY) < 6){
        pathPos ++;
        if (pathPos > path_get_number(myPath)){
           pathPos = path_get_number(myPath);
        }
        // If we made it to the end of the path
        else if (pathPos == path_get_number(myPath)){
             state = 'idle';
        }
        // Set the next x,y coords to go to
        else {
             pathX = path_get_point_x(myPath, pathPos);
             pathY = path_get_point_y(myPath, pathPos);
        }
    }

    // Take a step if nothing is in the way.
    mp_potential_step(pathX, pathY, spd, false);
Comments