Need help with: Compare sprite from an array of sprites and if match, do something

Hello everyone,

I am new to MS Makecode arcade and am trying to figure out the following scenario.
I have an array of two sprites which are randomly being created at random positions on X axis. All good so far.
Now, I want to be able to shoot a projectile from one of the sprites. For that I use if then logic, but it just doesn’t work. See screenhots below. Can you help me figure our where do I make a mistake?
If I do not do a comparison, both sprites are correctly shooting projectiles.

Thank you!


You should use the image block in advance or in the sprites section and there is 3 different blocks will help you with that
These are the blocks


You are my star! thank you! it worked like a charm.


No problem

1 Like

I am sorry for the double post, but I cannot edit the initial one. Here is a screenshot of the working portion:


no i meant you can only use one of the blocks not 2 of the block the same time

These 2 blocks you can use at the same time
but you need a boolean

“mySprite.image = image”

or the other one
That’s you have to use the 1 block just change the variable into the sprite you need like this

“myEnemy is equal to image (image)”

Ye like that I’m sorry if I made it confusing

sory for the late reply i was on somewere