Clone an Object

I need to create clones of an enemy sprite placed on where the original sprite is. I need the clones to slowly go to the center. I really need some help. I can’t figure out how to get a clone to set it’s size as the original sprite. I also cant figure out how to get the clones to go to the center. I am having a headache.

I also need to mention that I am clearly new to this program. I noticed that I can’t bring most of my experiences from other programs here as it is very different. I really appreciate your help, Thank you.

you can create an object of the type of the enemy object then resize with the same dimensions than the enemy object.
About the movement you cant use movement path or something similar don’t remmember now exaclty search in the forum or the tutorials.

Hi Thank you for your response I will try to use your method!

I’m assuming you resized your sprite in the Editor and now when you create new instances of it through events they come in their original size?

That can be solved by using an event to set all instances of the object to the width of the first object. Let’s say, for example, you resized your first object from 16x16 to 32x32; the way you would do the same to all the other objects is:

  do = 32 to the width of NewObject
  do = 32 to the height of NewObject

With the “Width” and “Height” actions found in “Sprite > Size”, and with no conditions, so it will keep on triggering.

To get the clones to move toward the center, use the action “Add a force to move toward a position” found in “Common Action For All Objects > Movement” and set the X and Y values of the center of the map.

An example of how that would work:

If scene variable "EnemyMove" = 1
  move NewObject to 320;240 with an instant force of 150 pixels.

And if the center is the center of the screen, it’s ever easier:

If scene variable "EnemyMove" = 1
  move NewObject to SceneWindowWidth() / 2;SceneWindowHeight() / 2 with an instant force of 150 pixels.

I added the scene variable condition merely because it’s always good to have a condition with a force, but you can get rid of that if you want.
I hope this helps you!

1 Like