Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make a sprite go to a clone
- BigBadCheeseMan
-
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
-
1000+ posts
How to make a sprite go to a clone
Maybe make a list of where all the clones are and then use
Something like that. Hope this helps.
go to x: (item ( v) of [ v]) y: (item (0 v) of [ v])
Something like that. Hope this helps.
- BigBadCheeseMan
-
8 posts
How to make a sprite go to a clone
Ok, I think I understand what you aer saying. Thanks!
- snakeboy712
-
100+ posts
How to make a sprite go to a clone
when I start as a clone
go to [Target]
- deck26
-
1000+ posts
How to make a sprite go to a clone
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.when I start as a clone
go to [Target]
Last edited by deck26 (March 11, 2016 10:13:45)
- jacquesimo
-
100+ posts
How to make a sprite go to a clone
If you follow me i will follow you!
Maybe this
Code to go to a sprite
If we wanted to go to clone 2
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
-
1000+ posts
How to make a sprite go to a clone
If you follow me i will follow you!That should be 3 and 4 for the second clone. Might be clearer to use separate lists for the x and y coordinates.
Maybe thiswhen 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 spritewhen 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 2when this sprite clicked
go to x: (item (2 v) of [clone pos v]) y: (item (3 v) of [clone pos v])
- cwkdavid3683
-
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
-
1000+ posts
How to make a sprite go to a clone
Please check the date of the original post before posting. This is an old topic. 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
- Discussion Forums
- » Help with Scripts
-
» How to make a sprite go to a clone