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

Legacy GM (SOLVED) gamemaker spawning top parent object instead of bottom child?

S

Shadowblitz16

Guest
does anybody know what could be causing GMS 1.4 to be spawning the top level parent instead of the bottom level child?

I actually have the obj parameter as "obj_buster_0" but it spawns a "Entity" object instead

here is my code
Code:
///Init Buster Weapon Projectiles

event_inherited();

///Blasts
ds_list_add_array_2d(charges[0], obj_buster_0, 0);
ds_list_add_array_2d(charges[1], obj_buster_1, 0);
ds_list_add_array_2d(charges[2], obj_buster_2, 0);


//Waves and Tails
ds_list_add_array_2d(charges[3], obj_buster_3L0, 0);
ds_list_add_array_2d(charges[3], obj_buster_3R0, 0);
ds_list_add_array_2d(charges[3], obj_buster_3L0, 1);
ds_list_add_array_2d(charges[3], obj_buster_3R0, 1);
ds_list_add_array_2d(charges[3], obj_buster_3L0, 2);
ds_list_add_array_2d(charges[3], obj_buster_3R0, 2);
ds_list_add_array_2d(charges[3], obj_buster_3L1, 2);
ds_list_add_array_2d(charges[3], obj_buster_3R1, 2);
ds_list_add_array_2d(charges[3], obj_buster_3L0, 3);
ds_list_add_array_2d(charges[3], obj_buster_3R0, 3);
ds_list_add_array_2d(charges[3], obj_buster_3L1, 3);
ds_list_add_array_2d(charges[3], obj_buster_3R1, 3);
ds_list_add_array_2d(charges[3], obj_buster_3L0, 4);
ds_list_add_array_2d(charges[3], obj_buster_3R0, 4);
ds_list_add_array_2d(charges[3], obj_buster_3L1, 4);
ds_list_add_array_2d(charges[3], obj_buster_3R1, 4);

Code:
/// Init Weapon Vars

event_inherited();

spawner = noone;
index = 0;
charge = 0;
charges[0] = ds_list_create();
charges[1] = ds_list_create();
charges[2] = ds_list_create();
charges[3] = ds_list_create();

Code:
///Spawn Projectiles

event_inherited();

var _list = charges[charge];
var _len = ds_list_size(_list);

var _array = ds_list_find_value(_list, index);
if (_array[1] == 0)
{
    instance_create_depth(x, y, depth-1, _array[1]);
    if (index == _len-1) { instance_destroy() }
    else { index ++; }
}
else
{
    _array[1] --;
    ds_list_replace(_list, index, _array);
    //break;
}

the obj_buster is a child of the Weapon object which is basicly a spawner that get spawned to spawn the projectiles
 
S

Shadowblitz16

Guest
Nevermind I found the problem I used index 1 for my array instead of 0
 
Top