You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"(Hint: in order for this to work right, you should reuse old IDs once the clones are deleted. So, for example, if the most recently created clone was number 6, and you hit d, clone number 6 should be deleted. Then, if a new clone is created, it should be a new clone number 6.)"
If you are going to give clones an id don't reuse the id. Just keep the ids that are being used in a list. We just told them how important lists are.
Then when you get to the bonus activity "All clones with higher numbers should be renumbered so that ID numbers remain contiguous." you don't need to renumber them.
You could also use the my clones block to get a list of all clones and not give them ids. I learned the hard way that broadcasting a message and having all sprites respond based on an id is incredibly slow. So slow that it makes Snap! unusable. Perhaps we shouldn't show them how to make a program broken by design. It also eliminates the potential race condition.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
"(Hint: in order for this to work right, you should reuse old IDs once the clones are deleted. So, for example, if the most recently created clone was number 6, and you hit d, clone number 6 should be deleted. Then, if a new clone is created, it should be a new clone number 6.)"
If you are going to give clones an id don't reuse the id. Just keep the ids that are being used in a list. We just told them how important lists are.
Then when you get to the bonus activity "All clones with higher numbers should be renumbered so that ID numbers remain contiguous." you don't need to renumber them.
You could also use the my clones block to get a list of all clones and not give them ids. I learned the hard way that broadcasting a message and having all sprites respond based on an id is incredibly slow. So slow that it makes Snap! unusable. Perhaps we shouldn't show them how to make a program broken by design. It also eliminates the potential race condition.
Beta Was this translation helpful? Give feedback.
All reactions