Discuss Scratch

Mqaurtx
Scratcher
3 posts

How to make projectiles shoot one at a time

Im making a game where the play can hold the mouse down to keep firing their weapon but holding this down causes a single script to run multiple times at once causing the player to shoot two bullets together instead of one and I can't fix it

Last edited by Mqaurtx (Oct. 17, 2023 00:28:44)

Jlerpy
Scratcher
1000+ posts

How to make projectiles shoot one at a time

Remember to share your project and include the link here so we can see what's going on with your code.
Mqaurtx
Scratcher
3 posts

How to make projectiles shoot one at a time

Jlerpy
Scratcher
1000+ posts

How to make projectiles shoot one at a time

The trouble is that the original Pew is generating clones, but so are each of the clones.
Two solutions I can think of:
Option 1. Give Pew a For This Sprite Only variable, “IsClone?”

when green flag clicked
set (IsClone?) to [No]

when I start as a clone
set (IsClone?) to [Yes]

Then wrap your clone script in
if <(IsClone?)  = [No]> then
create clone of [myself v]
end

Option 2. Have a different sprite create the clones of Pew. Sprite2 is a good candidate.
Mqaurtx
Scratcher
3 posts

How to make projectiles shoot one at a time

Yay! it worked thank you so much!
Jlerpy
Scratcher
1000+ posts

How to make projectiles shoot one at a time

Happy to help!

Powered by DjangoBB