Discuss Scratch

27AydenG
Scratcher
3 posts

How do I make clone 1 go to clone 2?

I am trying to make a peashooter shoot peas
I want to have multiple pea shooters shoot multiple peas
So, I make a clone of peashooter and I place it at x1 y1
Now I get the peas to start from x1 y1 and move along the x-axis.
I can do it if I had only one peashooter and one pea

But my challenge is with two or more peashooters, shooting peas at the same time
I can have 2 or more peashooters shooting only one pea (between the two of them) at a time
I want to have peashooter 1 and peashooter 2 shoot pea 1 and pea2 at the same time
And I want to do that using clones to make the code efficient.
If I do it with separate sprites, it will slow the game down over time and introduce lag.

Hope this makes sense.
If not, please ask me questions

THANK YOU

JustMeMeMe
Scratcher
100+ posts

How do I make clone 1 go to clone 2?

So first in the game you have peashooter 1 and it cloned itself to 2, and they all keep cloning.

Last edited by JustMeMeMe (Feb. 19, 2020 05:29:37)


Hi, I’m Trammic Brotacular, don’t ask me why I’ve got such a strange name.
Check out my shop!
Also, please check out my best friend in scratch!
when I receive [ introduce myself?]
repeat until <now following ::sensing block>
give you a call to tell you to fallow ::sound block
end
27AydenG
Scratcher
3 posts

How do I make clone 1 go to clone 2?

A link of what?
imfh
Scratcher
1000+ posts

How do I make clone 1 go to clone 2?

An easier way to do this would be to make the peashooter and pea “bullet” the same sprite. If a peashooter creates a clone of itself, the bullet will be on the same spot as the pea.

Example:

when green flag clicked // Flag deletes all clones
set [isClone v] to [0] // The original sprite is not a clone

when I start as a clone
change [isClone v] by (1) // 1 for peashooter, 2 for bullet
if <(isClone) = [1]> then
repeat until <...>
create clone of [myself v] // Since isClone = 1, the new sprite's isClone will be 1 + 1 = 2
wait (1.5) secs
end
else
if <(isClone) = [2]> then
repeat until <...>
change x by (7)
end
end
end

27AydenG wrote:

A link of what?
Probably to the project you are working on.

when signature read:: events hat
say [Not much here…] for (2) secs
27AydenG
Scratcher
3 posts

How do I make clone 1 go to clone 2?

Thanks so Much!!!!!!!

Powered by DjangoBB

Standard | Mobile