Cloning Enemies

Hi,
So here is a question that I haven’t yet found an answer to.

I’m using the method explained in the basic platform game tutorial with my enemy moving between 2 objects using collision. The problem is if I copy and paste these object somewhere else the copies, or clones, all wander off once the original enemy has been destroyed. This means that I have to create copies of the objects themselves and of course create copies of the corresponding events.

So my question is this: Is there an easier/faster way of doing this, or should I be using a different method altogether?

Thanks in advance for any light that can be shed on this.

Anne

The destruction of an enemy should not destroy the others as each instance of the object is totally independent (conditions are “intelligents” : for example, if you put a condition “MyPlayer is colliding with Enemy”, the next conditions and the actions of this event will take care of the collided enemy only).

Can you please show us your events ?

Sure!

I may have not been very clear, the other enemies aren’t destroyed, they move out of the bounds of their confining collision objects (GoLeft and GoRight) and just wander or float across and then off the board. :astonished:

I also noticed that if the distance between the cloned objects GoLeft and GoRight was wider than that of the original ones then the cloned enemy would stop and change direction as if it had collided with the original GoLeft and GoRight.

Can you send us your project ? everything seems fine in that screenshot. :wink:

How do I do that? :confused:

You put your project’s folder inside a ZIP and then put it on the forum (look below the message textbox when you are writing a message, you can send a file (the tab aside of “Options”).

OK thanks, I didn’t see the Upload attachment tab. :unamused:

I’ve added a clone in scene 1 and strangely enough it’s not going walkabout when I destroy/delete the original one. However it moves within the (more restricted) bounds of the original enemy up to the point the original is destroyed then it moves within its own bounds.

[attachment=0]Santa.zip[/attachment]

When you want to access an object’s variable (not a scene variable), you have to use the dedicated condition/action.
You can’t use the scene variable condition and put “GoLeft of SlimeEnemy” as variable name, it will not work (or, it works, but it’s a single scene variable called “GoLeft of SlimeEnemy”, not a variable unique for each SlimeEnemy).
You will find the actions and conditions to test/set a value for an object’s variable in the “> All objects > Variables” category (not in " > Variables" category". In these conditions/actions, you will have to put the concerned object and its variable name.
Basically, you just have to fix this problem (in each events where you are using object’s variable) and it will work.

(You can delete SlimeEnemy2 and 3 as it’s useless).

OK, I see exactly what I was doing wrong. I have corrected and everything is working fine now.
Thank you for taking the time to help me :slight_smile: