![]() It gives other threads (scripts, clones, sprites) the time to catch up with the current one. Waiting zero seconds may seem like a no-op, but it actually has effect: ![]() In most cases, this can be fixed by adding a 'wait 0 seconds' block immediately above the 'delete this clone' block. This script returns a true or false value. In the above example, the sprite is named Crystal. Select the name of the sprite you want to detect from the dropdown menu. The first clone to detect the collision deletes itself, thereby erasing the incident before the other clone has had a chance to detect it. The collision detection is created by using a conditional statement combined with the touching sprite which is Boolean (true or false) value. This is a 'race condition': simultaneous events never happen exactly at the same time. When using this to make clones disappear as they collide, you may notice that only one clone will disappear, and the other will survive. ![]() Notice there's a 'touching Sprite2' block there. Drag the block from the code area to Sprite2 (as seen in the sprite collection, bottom right).Open the block's dropdown and select Sprite2.From the 'sensing' group, drag a 'touching' block onto the code area.If Sprite2 is the only sprite in the project, add a dummy sprite you can safely remove it after step 4.) As seen in your screenshot, the dropdown list of the 'touching' block shows a list of all sprites in the project (in this case Sprite1) except the current sprite (Sprite2).įortunately, it is possible to have a 'touching Sprite2' block within Sprite2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |