A
AtomicToilet
Guest
Hola!
My question is: what's the best way to handle this?
At the moment, an obj_worker unit depletes an obj_resources' 'resource' variable, and the obj_resource is destroyed once resource = 0. But, because I used other.resource (in the obj_worker collision event with obj_resource) this then causes all the other obj_resource instances to disappear as soon as the worker goes to another one to mine it.
Here's the collision code I'm using at the moment:
I wondered if somehow calling an instance id would be the best way to do this, so that only that specific instance's resource variable is affected? Or maybe an array...? Regards the latter, I understand these can be used to store multiple variables but I'm not entirely clear how I would call only the relevant one for each individual obj_resource instance.
My question is: what's the best way to handle this?
At the moment, an obj_worker unit depletes an obj_resources' 'resource' variable, and the obj_resource is destroyed once resource = 0. But, because I used other.resource (in the obj_worker collision event with obj_resource) this then causes all the other obj_resource instances to disappear as soon as the worker goes to another one to mine it.
Here's the collision code I'm using at the moment:
Code:
with (other)
{
rock_resources -= .1
}
if other.rock_resources <= 0
{
state = "mined";
}
Last edited by a moderator: