Discuss Scratch

KLabz
Scratcher
15 posts

how to read Clone direction

do anyone know about how to view / use the directions of clones? I already tried using this script:
when I start as a clone
forever
go to [AI robot v]
point towards [end point v]
set [direction v] to (direction)
end
but it doesn't work

what I am working on
https://scratch.mit.edu/projects/1062602908

Last edited by KLabz (Sept. 4, 2024 10:07:50)

RokCoder
Scratcher
1000+ posts

how to read Clone direction

If the clones have numeric IDs, having them store their positions/directions in lists using the IDs as the indexes is a good approach for this
KLabz
Scratcher
15 posts

how to read Clone direction

sorry because late responding. did you mean
(Clone1 :: list)
or
(clone :: list)
add [dir] to [clone v]
?
thx

Coming this september! AI Labs

Last edited by KLabz (Sept. 5, 2024 02:32:05)

NMario84
Scratcher
1000+ posts

how to read Clone direction

Basically this

when green flag clicked
delete all of [Clone List v]
Create clones
forever
go to x:(x position) y:(y position) // NOT important, but it keeps the project running..
end

define Create Clones
// [x] Run without screen refresh
set [Clone ID v] to (-3)
repeat (4)
change [Clone ID v] by (4)
create clone of (myself v)
end
set [Clone ID v] to (0)

Then do this, assuming you have a list ready to go.

When I start as a clone
go to (random position v)
add (join ( ID ) (Clone ID)) to [Clone List v] // The first orange (ID) Should be written as text in white box. IDK why it's coming up orange here
add (direction) to [Clone List v]
add (x position) to [Clone List v]
add (y position) to [Clone List v]
say (Clone ID)
forever
move (2.5) steps // Just an example, NOT important.
replace item ((Clone ID) + (1)) of [Clone List v] with (direction) // IMPORTANT to keep track of clone's location
replace item ((Clone ID) + (2)) of [Clone List v] with (x position) // IMPORTANT to keep track of clone's location
replace item ((Clone ID) + (3)) of [Clone List v] with (y position) // IMPORTANT to keep track of clone's location
end
skkoo7
Scratcher
2 posts

how to read Clone direction

If you use clones, use for this sprite only variables, as clones count as one different sprite then other clones/sprites using for this sprite only.

Powered by DjangoBB