S
shrunkenmaster
Guest
I'm trying to work out how to place one enemy on each of the paths I have.
I used a switch to select a path which works fine, but I can't figure out the ds_list to select 4 random, but different, numbers.
Eventually I'll have more paths than instances.
Very new to this, so any guidance would be great!
oSpawner (Create)
I used a switch to select a path which works fine, but I can't figure out the ds_list to select 4 random, but different, numbers.
Eventually I'll have more paths than instances.
Very new to this, so any guidance would be great!
oSpawner (Create)
Code:
minpath=0;
maxpath=3;
buzzpath=0;
buzzspeed = random_range(.2,.5);
// Pick a random path
ds = ds_list_create();
var index = 0;
repeat(maxpath)
{
ds[| index++] = irandom(maxpath);
}
//get path value
minpath =0;
if (!minpath > maxpath)
{
buzzpath = ds[| minpath];
//switch
switch (buzzpath)
{
case 0: with instance_create_layer(x, y, "Buzz", oBuzz)
{
buzzspeed = random_range(.2,.5);
path_start(path0,buzzspeed,path_action_reverse,1);
}
break;
case 1: with instance_create_layer(x, y, "Buzz", oBuzz)
{
buzzspeed = random_range(.2,.5);
path_start(path1,buzzspeed,path_action_reverse,1);
}
break;
case 2: with instance_create_layer(x, y, "Buzz", oBuzz)
{
buzzspeed = random_range(.2,.5);
path_start(path2,buzzspeed,path_action_reverse,1);
}
break;
case 3: with instance_create_layer(x, y, "Buzz", oBuzz)
{
buzzspeed = random_range(.2,.5);
path_start(path3,buzzspeed,path_action_reverse,1);
}
break;
}
minpath +=1
}