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.
If not, please ask me questions

THANK YOU

JustMeMeMe

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

27AydenG

A link of what?

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 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.

27AydenG

Thanks so Much!!!!!!!

williamtiberio

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

williamtiberio

when green flag clicked
forever
wait (pick random (1) to (10)) secs
when I start as a clone
end
????????????????
how?

williamtiberio

when green flag clicked
forever
wait (pick random (1) to (10)) secs
create clone of [ v]
end

williamtiberio

Oumuamua

williamtiberio wrote:


You should read those Guidelines before posting anything.