G
guitarmonkeys14
Guest
Hey everyone, I am currently making a scrolling 2D top down shooter and I am stuck. I have been using a combination of DnD and GML so any help is greatly appreciated.
I currently have the game set up to have random spawn points for my enemies. Basically boulders that are created out of view above the screen then scroll down the map with the ground. I then have an object spawn with the boulders that spawns the enemies. I already have the boulders set up to be destroyed when shot.
My problem is that I cant get only the specific spawn point to destroy when that specific boulder's hp is less than 0. All of the other spawners on the map go with it. I have also tried if_instance_exists but nothing has worked so far. any suggestions?
obj_ctrl_lvl_endless (Alarm event)
obj_boulder (Collision with obj_laser)
obj_zombie1spawn
Any help would be greatly appreciated,
Thank you in advance
I currently have the game set up to have random spawn points for my enemies. Basically boulders that are created out of view above the screen then scroll down the map with the ground. I then have an object spawn with the boulders that spawns the enemies. I already have the boulders set up to be destroyed when shot.
My problem is that I cant get only the specific spawn point to destroy when that specific boulder's hp is less than 0. All of the other spawners on the map go with it. I have also tried if_instance_exists but nothing has worked so far. any suggestions?
obj_ctrl_lvl_endless (Alarm event)
Code:
// Create Instance
obj_newboulder2 = instance_create_layer(random_range(3000,200), -1000, "Instances", obj_boulder2);
// Set Alarm Countdown
alarm_set(2, random_range(300,600));
// If Expression
if(instance_exists(obj_newboulder2))
{
// Create Instance
tempzombie1 = instance_create_layer(obj_newboulder2.x, obj_newboulder2.y-300, "Instances", obj_zombie1spawn);
// Set Alarm Countdown
alarm_set(2, random_range(300,600));
// If Expression
if(!(instance_exists(obj_newboulder2)))
{
// Destroy Instance
with(temp) instance_destroy();
}
}
Code:
// Assign Variable
hp += -34;
// Destroy Instance
with(other) instance_destroy();
// If Variable
if(hp <= 0)
{
// Destroy Instance
instance_destroy();
// Destroy Instance
with(obj_zombie1spawn) instance_destroy();
}
Code:
// Create Instance
instance_create_layer(x, y, "Instances", obj_zombie);
// Set Alarm Countdown
alarm_set(0, random_range(450,500));
Thank you in advance