Set all visible sprites of list speed to 10

I have a list of 10 sprites,now i want to write some DRY(Don't repeat yourself) code that makes button's speed to 10 ONLY IF THE SPRITE IS VISIBLE...

Please help ASAP...
Thanks and regards

Maybe this will help you

1 Like

Wait i am trying

@dora_paz look, this error is coming

You have to use loop , for each item or for each number from....
In my example when I press the button for all sprites speed increase from 0 to 20. Play with the code according to your needs

test_image.aia (3.7 KB)

wait i am trying'

can you send an image instead, the file is not opening?

BTW the advice worked, i owe you a lot, thanks
Just another doubt, if all imageSprites.visible = false... display "you win"

You need another variable, called YouWin, initially true.
In the loop over the sprites, add this statement:
set YouWin to and(YouWin, not(sprite.Visible))

After the loop ends,
if YouWin then
display "You Win!"

@ABG should I put this block in screen.initialize or somewhere else,
Sir please tell ASAP.

Please export your project and post it here.

somewhere else, where you loop over the sprites like in Dora Paz's example.

I am sending the .aia file please check it as I can not figure it out... Sent you please see

I don't do private lessons.
The whole point of a board like this is to say it once, so multiple people can benefit from it afterwards.

Here is a general answer for you.
An animated game has events that fire, like

  • clock timers
  • touch events
  • edge contacts

Those events are the places where you would respond to the event and re-evaluate your winning/losing assessments.

Sir even I know that these boards are for everyone to see but the fact is that the project which I am speaking about is a part of my submission at the HACKATHON 2020 that is why... after this week ends, i will make my aia file public, but please consider taking a look at it once, I shall be highly obliged,

You can also export draggable copies of individual events.

Please download and post each of those event block(s)/procedures here ...
(sample video)

or(tried both, the same problem occurs)

The only problem is that the if statement needs to check if all sprites are not visible, but it starts displaying that message only when one sprite has been made invisible...
That is the whole point of my question...

Read ABGs answer again. You should set youwin to true before you start the loop, and you should use a logical AND block for testing in the loop.

Look in the second image
It gives the same result

Unfortunately, you did not create draggable blocks.
Watch the whole Loom video again to see how.
If you edit the png, you break it.

You did not read what I wrote. It should be something like this:
blocks (44)
You should initialize youwin before the loop, and find out if it is true after the loop.