GM:S 1.4 Path finding odd isue

Discussion in 'Programming' started by Rodimus, May 3, 2017.

  1. Rodimus

    Rodimus Guest

    Hello I made a global var, and assign to it an mp_grid. It's working fine, but for an unknow reason the first created instance what using the path not start moving. I checked the path length and it says -1 at the first unmoving instance. I'll show what i'v done:

    object 1:

    Create Event:
    globalvar roomgrid;
    roomgrid = mp_grid_create(0,0,room_width/32,room_height/32,32,32);
    mp_grid_add_instances(roomgrid,o_wall,false);
    color=choose(c_red,c_blue,c_aqua,c_lime,c_yellow);
    alarm[0] = 200;
    Alarm 0:
    e=instance_create(x+32,y,other_object);
    e.color = color;

    with (e)
    {
    path = path_add();
    path = mp_grid_path(roomgrid,path,x,y,o_base.x,o_base.y,false);
    path_start(path,2,path_action_stop,false);
    }
    alarm[0] = 60;

    Why the first spawned instance not do anything? The other works perfectly!
     
    Last edited by a moderator: May 3, 2017
  2. chico_haze

    chico_haze Member

    Joined:
    Nov 9, 2016
    Posts:
    58
    Rodimus likes this.
  3. Rodimus

    Rodimus Guest

    You was right! I totally forgot how this works! Thank you!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice