Multiple instance of objects

Hey there !

I need to create an object when clicking on a specific area. Then this object follows the mouse, until the mouse is clicked again. And then, they object is released on his actual position.
Right now, I am using thoses events, that work fine.

Thing is, I need to be able to create multiple object, like in this example, multiple resistance object, everytime I click on the specific area. And its actually taking back the first object I’ve created to make it move again.

How can I create multiple objects that are further considered individually ?

Thanks a lot !

I would look at adding a boolean object variable to indicate that the object is following the mouse. Set it to true upon creation on the mouse click, and false upon the subsequent mouse click. Only objects with the variable set to true should follow the mouse.

Mr Men, you are the man !

Works like a charm, thanks a lot.

Well, got another issue …

I’ve finally try something different. I need to be able to create up to 17 times the same object, object that can be later treated independantely.

But when creating my second object (spawn = 2), it doesnt make a new one but always move the one already in place …

Resistance is a groupe and I guess its this part that is causing problem …

Thanks a lot.

It’s creating a new one, but you’re moving all the objects that are in the resistance group, which includes the newly create one, onto the same position.

Yes, because you’re applying the position change to all resistance objects in the scene.

If you want to treat the objects independently, you need to be able to uniquely identify them. The best way to do that here is to add an object variable. In your case, this means adding something like spawn_id to all objects in the resistance group, and set it to the value of scene variable spawn when you create the resistance object.

And then, how do I move an object using is spawn id ?

Set the condition Variable spawn_id of resistance = Variable(_name_of_variable_). Any actions in that event (or subevents of that event) will only be performed on the resistance objects with an spawn_id of variable’s value.

1 Like


sorry I cant get it. Here are my conditions, still having the same issue.

Thanks a lot

You also need to add this :

to this event :

Otherwise it’ll move all resistance group objects to the mouse :

1 Like