Detecting Clones

Материал из Поле цифровой дидактики
Версия от 11:33, 21 июля 2022; Patarakin (обсуждение | вклад) (1 версия импортирована)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)

In order to detect properties of specific clones. a variety of lists and local variables need to be used. Local variables are duplicated with a clone's properties, but a sprite cannot detect an individual clone's local variable's value. However, a clone can detect a sprite, which can therefore send a message to trigger the sprite's scripts. In order for a sprite to detect the properties of a clone, the clone must use lists in order to "communicate" with the sprite.

For the following scripts, assume the following:

  • clones — a global variable used to count how many clones have been created.
  • cloneid — a local variable duplicated with the clone that represents what clone number in chronological order of creation it is.
  • quantities — a list used to store the wanted value for each clone.
  • Sprite1 — the sprite which creates the clones

These following scripts would go in Sprite1:

whenclickeddeleteallofquantitiessetclonesto0

When creating a clone of Sprite1, use the following script in Sprite1:

addtoquantitieschangeclonesby1createcloneofmyself

If the desired value is a reporter, use this script in Sprite1:

whenIstartasaclonesetcloneidtoclonesforeverreplaceitemcloneidofquantitieswith...

Then itemxofquantities will return the quantity for the clone with the clone ID x.

If the desired value is a boolean, use this script in Sprite1:

whenIstartasaclonesetcloneidtoclonesforeverreplaceitemcloneidofquantitieswith...

Then itemxofquantities=true will return the quantity for the clone with the clone ID x.

See Also

ru:Клонирование/Обнаружение клонов ja:クローン情報へのアクセス