# 27AydenG

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.

THANK YOU

# JustMeMeMe

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

# imfh

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 clonesset [isClone v] to [0] // The original sprite is not a clonewhen I start as a clonechange [isClone v] by (1) // 1 for peashooter, 2 for bulletif <(isClone) = [1]> then repeat until <...>create clone of [myself v] // Since isClone = 1, the new sprite's isClone will be 1 + 1 = 2wait (1.5) secsendelseif <(isClone) = [2]> thenrepeat until <...>change x by (7)endendend`

27AydenG wrote:

Probably to the project you are working on.

# 27AydenG

Thanks so Much!!!!!!!

# williamtiberio

how do you make 2 peashooters or more shoot a difrent 1 sprite?

# williamtiberio

`when green flag clickedforeverwait (pick random (1) to (10)) secswhen I start as a cloneend`
????????????????
how?

# williamtiberio

`when green flag clickedforeverwait (pick random (1) to (10)) secscreate clone of [ v]end`

# Oumuamua

williamtiberio wrote:

You should read those Guidelines before posting anything.