Discuss Scratch

DragonFire973
Scratcher
73 posts

How to apply different coordinates to each clone.

So, I have something where I need a sprite to clone, and then give its clone a new coordinate. How would I do this, and is it even possible?

I can code in C#, JS, and Lua. I'm not great with any of them.

This is a signature.
awesome-llama
Scratcher
1000+ posts

How to apply different coordinates to each clone.

The answer probably is local variables. They allow clones to have their own, unique copy of the variable, allowing it to be different for each clone.


Starstriker3000
Scratcher
1000+ posts

How to apply different coordinates to each clone.

Use these scripts (make sure you make identical costumes, and the number of costumes should equal the number of sprites you want):

switch costume to [1 v] // apply this to the Sprite you're cloning
create clone of [myself v]
switch costume to [2 v]
create clone of [myself v]
switch costume to [3 v]
create clone of [myself v]
...

when I start as a clone
... // this applies to all clones
if <(costume [number v] :: looks) = [1]> then
... // this applies only to the clone made with costume 1
end
if <(costume [number v] :: looks) = [2]> then
... // this applies only to the clone made with costume 2
end
if <(costume [number v] :: looks) = [3]> then
... // this applies only to the clone made with costume 3
end



This is my official 500th post!
super_epic_games
Scratcher
43 posts

How to apply different coordinates to each clone.

what i found works is if when you clone them, turn them one degree each time. since scratch only allows 300 clones at once, and there's 360 degrees in a circle, you will not run into any problems. also, when you create it, you are going to have to have two lists: 1 for all the angles and the other one for the variables. here's some code for it:
when green flag clicked
repeat (...)
create clone of [myself v]
add (direction) to [ANGLES v]
add [YOUR VARIABLE] to [varibles v]
end

g'day from Australia
the outback country
DragonFire973
Scratcher
73 posts

How to apply different coordinates to each clone.

That is so smart!! Thank you!!

I can code in C#, JS, and Lua. I'm not great with any of them.

This is a signature.
DragonFire973
Scratcher
73 posts

How to apply different coordinates to each clone.

Also, do you know how to sense what another sprite's costume number is?

I can code in C#, JS, and Lua. I'm not great with any of them.

This is a signature.
deck26
Scratcher
1000+ posts

How to apply different coordinates to each clone.

DragonFire973 wrote:

Also, do you know how to sense what another sprite's costume number is?
For a sprite just use the sensing block

([ v] of [Sprite1 v])
DragonFire973
Scratcher
73 posts

How to apply different coordinates to each clone.

K, thanks.

I can code in C#, JS, and Lua. I'm not great with any of them.

This is a signature.
ScratchCodeSoftware
New to Scratch
1 post

How to apply different coordinates to each clone.

hi this is my 1st time posting on forums
SkiingSkeleton
Scratcher
16 posts

How to apply different coordinates to each clone.

Welcome to the forums! Contrary to what my account says, I'm not new to scratch, and I can say sticking around is worth it. Just for future reference, try not to post on old threads, and try to keep posts on-topic. You can introduce yourself over here in the new scratchers forum: https://scratch.mit.edu/discuss/6/

May the force be with you!

Where was I when the rockets came to life and carried you away into the alligator sky?

Powered by DjangoBB