[Solved] Create a shadow for each enemy object instances and move for each instances

Good day Sirs,
after days of tests …and failures i decided to post this little (but it seems not) problem here.

-My enemy object is called “e0”
-Basically i made a simple shadow sprite that i put under the feet of my enemy

1 the enemy (and i know how) and
2 the shadow behind each of my enemy instances

and move em separately under their feet, cos as you can see in the picture put the shadow under the feet of the enemy doesn’t work cos it create all the shadows under the 1st enemy created since i don’t know a way to give x/y position of instances.

Looking for gandalfs help…

Try link to object so that way you assign each shadow you create to an instance of e0

Ok where i do have to put the code and which object 1st and which second?
Also how do i make the shadow move for each instances…?
Sorry, i understand your answer and i tried befor the post but probably i don’t get how link objects work.

When you create shadowe

Link e0 to shadowe

In other event

Foreach e0
Take into account all e0 linked to shadowe


Take into account all e0 linked to shadowe
Change X position shadowe
Change Y position shadowe

…aaaand…it doesn’t work…, no shadow under created enemy … do i miss/mess something?.
pic…also i see that there is an order error …since i want the shadow to trigger once ofc and create an enemy whenever i want, not just at the beginning of the scene…

1 Like

Hi, here is an example for linking two objects (one is randomely created). It is probably not the best way to do it, but it works.

my code looks like yours but i need the shadow to move on each object instance since is a platform game… i see that your code use the put action to linked object… i’ve also tried that with no success…:persevere:

What about putting both create actions (first e0 and then shadowe) in one event?

like this…

…btw shadow is visible and moving for one enemy only…or probably both are created but overlap to one enemy cos i’m updating the move of shadow to enemy object and not instance…omg…i’m loosing hopes…

W8 …something is working now…putting the code here…i’m testing…will let you know…i had to split the repeat conditions cos the trigger once problem…

it seems shadows are created for each enemies and move indipendently for each instances…
Thank you Drona and Ulises for the help…i’m probably turn this to Solved soon…you’re both gandalfs…:wink: