could someone help me with this code?

Posted by glory_in_death on July 26, 2006, 9:33 p.m.

ok, this script is to check for a collision with a certain enemy. Each enemy has a parent of objEnemyBasic, used when calling something in another script.

//collision for Ghost1
if place_meeting(x,y+vspeed,argument6)
   {
   if vspeed > 0 && argument6.y > 8
       {
       with (argument6)
           {
           //death animation
           dead = true;
           speed = 0;
           image_speed = argument7;
           }
       }
   else if argument6.dead = false
       {
       instance_destroy();
       }
   }

the only problem im having with this is , when I jump on one enemy, all the enemies with the parent of objEnemyBasic will die. I know I can just remove the parent, but for simplicity reasons, (as this is also an editable engine that I may release) is there a way that I can just check for one certain object/instance to destroy, intstead of all with the same parent?

thanks for viewing this.

Comments

melee-master 18 years, 3 months ago

I'd be able to answer your question real fast, most likely, but I don't have a clue how anything else is set up.

KaBob799 18 years, 3 months ago

what font is this? its hard to read so small.

DesertFox 18 years, 3 months ago

I was thinking the same thing, bob.

shadowstrike32 18 years, 3 months ago

Are you passing objEnemyBasic as the 7th argument? because if you are that will happen.

remember, instead of putting an object's name into that argument, you should put it's reference/id instead. I beleive place_meeting returns the objectID that it is meeting with. If not, figure out which function does, and use that as the argument to the with() statement.

shadowstrike32 18 years, 3 months ago

else if (argument6.dead == false)

{

with (argument6) { instance_destroy(); }

}

That sould fix things up a bit.

Malaika 18 years, 3 months ago

try with (other) instead of with (argument6)

glory_in_death 18 years, 3 months ago

melee-master helped me fix it but,

@mailaika: if I do that, then I would destroy ANTYHING I land on, even floors, as this is an editable engine, hence the arguments. I know the confusion is my fault as I didn't elaborate more but oh well, Its fixed now.