Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to draw 2 hexagons concurrently, please?
- snakafj
-
23 posts
How to draw 2 hexagons concurrently, please?
my project doesn't work as I expected it to.
http://scratch.mit.edu/projects/49483234/
What should I do to draw two hexagons at the same time(ie, not one hexagon after another)?
Thank you.
http://scratch.mit.edu/projects/49483234/
What should I do to draw two hexagons at the same time(ie, not one hexagon after another)?
Thank you.
- The_Grits
-
1000+ posts
How to draw 2 hexagons concurrently, please?
Try using two separate sprites or using clones. The two scripts are basically giving commands to the sprite at the same time, causing the unwanted effect.
- snakafj
-
23 posts
How to draw 2 hexagons concurrently, please?
Try using two separate sprites or using clones. The two scripts are basically giving commands to the sprite at the same time, causing the unwanted effect.
Thank you very much for your advice, which was a Columbus' egg sort of eye-opener to me!
I now created sprite1 and sprite2, and assigned code block 1 to sprite1 and another to sprite2.
But the first stroke of the 2nd hexagon always got cleared for reasons I don't know.
So, I decided to separate the ‘clear’ (and Broadcast) from the rest of the codes, and it works perfectly now.
Thank you again for your help.
ps: 2 interchangeable blocks are placed to the right of the code block of sprite2, FYI.
- deck26
-
1000+ posts
How to draw 2 hexagons concurrently, please?
I'm guessing what you had before was two green flag scripts or two scripts starting at the same time (same trigger) but that means you can't tell which will run first. Much better to do your initialisations including the clear before you actually start doing anything which is essentially what you've now done.
- snakafj
-
23 posts
How to draw 2 hexagons concurrently, please?
I'm guessing what you had before was two green flag scripts or two scripts starting at the same time (same trigger) but that means you can't tell which will run first. Much better to do your initialisations including the clear before you actually start doing anything which is essentially what you've now done.
Yes, in each of my two previous projects, I had 2 blocks of scripts, each capped with a green flag, in the hope that, that way, both blocks would start exactly at the same time, but your post helped me think again.
Now, after reading your post, I'm telling myself like this:
When I have more than one block, each block with its own green flag, they don't start simultaneously. Instead, one of them starts first, followed by another a thousandth, a millionth .. of a second later, and so on. That's why the first stroke of one hexagon got ‘cleared’ by the clear command of another block.
Interestingly, the following project of mine worked satisfactorily to human eyes although it had 3 blocks with 3 green flags because, I now understand, the scripts had no ‘Clear’ command:
http://scratch.mit.edu/projects/43465802/
Thank you again for your help.
Last edited by snakafj (Feb. 28, 2015 05:21:18)
- Discussion Forums
- » Help with Scripts
-
» How to draw 2 hexagons concurrently, please?