Discuss Scratch

BigBadCheeseMan
Scratcher
8 posts

How to make a sprite go to a clone

I want to have my sprites clone and go to each others' clones, but of course they go to the actual ones instead. How do I fix this?
jokebookservice1
Scratcher
1000+ posts

How to make a sprite go to a clone

Maybe make a list of where all the clones are and then use
go to x: (item ( v) of [  v]) y: (item (0 v) of [  v])

Something like that. Hope this helps.
BigBadCheeseMan
Scratcher
8 posts

How to make a sprite go to a clone

Ok, I think I understand what you aer saying. Thanks!
snakeboy712
Scratcher
100+ posts

How to make a sprite go to a clone

when I start as a clone
go to [Target]
deck26
Scratcher
1000+ posts

How to make a sprite go to a clone

snakeboy712 wrote:

when I start as a clone
go to [Target]
That go to block can't move you to a clone unless the clone happens to be at the same place as the sprite of that name.

Last edited by deck26 (March 11, 2016 10:13:45)

jacquesimo
Scratcher
100+ posts

How to make a sprite go to a clone

If you follow me i will follow you!

Maybe this

when green flag clicked
delete (all v) of [Clone pos v]
set [clone id v] to [1]
create clone of [myself v]
set [clone id v] to [2]
create clone of [myself v]

when I start as a clone
add (x position) to [clone pos v]
add (y position) to [clone pos v]
forever

replace item ((Clone id v)) of [clone pos v] with (x position)
replace item ((Clone id) + (1)) of [clone pos v] with (y position)
end

Code to go to a sprite

when this sprite clicked
go to x: (item (1 v) of [clone pos v]) y: (item (2 v) of [clone pos v])

If we wanted to go to clone 2


when this sprite clicked
go to x: (item (2 v) of [clone pos v]) y: (item (3 v) of [clone pos v])

Last edited by jacquesimo (March 11, 2016 15:04:03)

deck26
Scratcher
1000+ posts

How to make a sprite go to a clone

jacquesimo wrote:

If you follow me i will follow you!

Maybe this

when green flag clicked
delete (all v) of [Clone pos v]
set [clone id v] to [1]
create clone of [myself v]
set [clone id v] to [2]
create clone of [myself v]

when I start as a clone
add (x position) to [clone pos v]
add (y position) to [clone pos v]
forever

replace item ((Clone id v)) of [clone pos v] with (x position)
replace item ((Clone id) + (1)) of [clone pos v] with (y position)
end

Code to go to a sprite

when this sprite clicked
go to x: (item (1 v) of [clone pos v]) y: (item (2 v) of [clone pos v])

If we wanted to go to clone 2


when this sprite clicked
go to x: (item (2 v) of [clone pos v]) y: (item (3 v) of [clone pos v])
That should be 3 and 4 for the second clone. Might be clearer to use separate lists for the x and y coordinates.
cwkdavid3683
Scratcher
5 posts

How to make a sprite go to a clone

Make a variable X and a variable Y, set them forever, to your clone's X and Y, then have the sprite head towards those coordinates
deck26
Scratcher
1000+ posts

How to make a sprite go to a clone

cwkdavid3683 wrote:

Make a variable X and a variable Y, set them forever, to your clone's X and Y, then have the sprite head towards those coordinates
Please check the date of the original post before posting. This is an old topic.

Powered by DjangoBB