Discuss Scratch

PBfriedpanSTUDIOS
Scratcher
60 posts

How do I get the X & Y position of clones?

How do I get the X & Y position of clones?
Modz31
Scratcher
72 posts

How do I get the X & Y position of clones?

setclone xtoxposition for this sprite onlysetclone ytoyposition for this sprite only
archgavriel
Scratcher
51 posts

How do I get the X & Y position of clones?

whenclickedsetcloneidto0repeat10addtolistaddtolistcreatecloneofmyselfchangecloneidby2


whenIstartasaclonereplaceitemcloneid-1voflistwithxpositionreplaceitemcloneidoflistwithyposition
cloneid is for this sprite only
PBfriedpanSTUDIOS
Scratcher
60 posts

How do I get the X & Y position of clones?

archgavriel wrote:

whenclickedsetcloneidto0repeat10addtolistaddtolistcreatecloneofmyselfchangecloneidby2


whenIstartasaclonereplaceitemcloneid-1voflistwithxpositionreplaceitemcloneidoflistwithyposition
cloneid is for this sprite only
I just remembered that i have to keep saving the position of the clone every single tick until the clone gets removed, so that doesnt work.
deck26
Scratcher
1000+ posts

How do I get the X & Y position of clones?

PBfriedpanSTUDIOS wrote:

archgavriel wrote:

whenclickedsetcloneidto0repeat10addtolistaddtolistcreatecloneofmyselfchangecloneidby2


whenIstartasaclonereplaceitemcloneid-1voflistwithxpositionreplaceitemcloneidoflistwithyposition
cloneid is for this sprite only
I just remembered that i have to keep saving the position of the clone every single tick until the clone gets removed, so that doesnt work.
So put a loop around the replace items blocks.
PBfriedpanSTUDIOS
Scratcher
60 posts

How do I get the X & Y position of clones?

deck26 wrote:

PBfriedpanSTUDIOS wrote:

archgavriel wrote:

whenclickedsetcloneidto0repeat10addtolistaddtolistcreatecloneofmyselfchangecloneidby2


whenIstartasaclonereplaceitemcloneid-1voflistwithxpositionreplaceitemcloneidoflistwithyposition
cloneid is for this sprite only
I just remembered that i have to keep saving the position of the clone every single tick until the clone gets removed, so that doesnt work.
So put a loop around the replace items blocks.
Then the clone id changes all the time and the positions of the clones gets replaced with another clone’s X and Y positions
deck26
Scratcher
1000+ posts

How do I get the X & Y position of clones?

PBfriedpanSTUDIOS wrote:

deck26 wrote:

PBfriedpanSTUDIOS wrote:

archgavriel wrote:

whenclickedsetcloneidto0repeat10addtolistaddtolistcreatecloneofmyselfchangecloneidby2


whenIstartasaclonereplaceitemcloneid-1voflistwithxpositionreplaceitemcloneidoflistwithyposition
cloneid is for this sprite only
I just remembered that i have to keep saving the position of the clone every single tick until the clone gets removed, so that doesnt work.
So put a loop around the replace items blocks.
Then the clone id changes all the time and the positions of the clones gets replaced with another clone’s X and Y positions
No, the cloneid is presumably a local variable so each clone has its own value and the loop is only around the code that updates the list.

But in the code above cloneid should start with value 2 or the first clone is trying to access items -1 and 0 in the list.

Last edited by deck26 (March 15, 2024 09:15:31)

Powered by DjangoBB