|
2 questions. 1) I noticed there is only instance_count, which counts the total instances in a room. YET when you look in the D&D, the panel allows you to check instances only of particular objects. Same for GMS.
Since I cannot stand D&D anymore and do everything by code, could someone please tell me how I can do the equivalent of the action check instance count for a specific object ?
Example, I have a controller object in a room, what if I wanted it to check number of instances of a specific object in the room, how would I go about....
if I use the if (instance_count), that checks the total active instances in a room !
---------------------------------------------------
2) Destroying individual instances
Now I know how to do this by having the object itself detect collision with another and calling a destroy function, it will destroy self (the instance only, not all the object).
What if I want to control this from another object.
Example, object A shoots Objects B, but collision against object b is checked in A. B is a solid object.
So in Object A I would use
if (place_meeting(x,y,obj_b) ... ...
What should I do next ?
If I use
with (obj_b) { destroy_instance(); }
it will kill all instances of object b ! I want only the instance of object b that was hit by object a to be killed.
I can do this with the D&D object kill object, in the panel select other..... This will cause whatever object a was hit to be killed. How the hell can I replicate this with GML?
I tried using other,self, etc. does not work.
This is the same in GMS. I find it ridiculous I have to use D&D and cannot do this in GML.
|