Discuss Scratch

nighthawk075
Scratcher
18 posts

How to make a sprite shoot projectiles

In the final level of my most recent game I was wondering how to make a sprite shoot projectiles like bullets. I've thought of things like making the projectile part of the sprites costume but I am sure that wont work. thanks for helping
rollercoasterfan
Scratcher
1000+ posts

How to make a sprite shoot projectiles

Well, you could make a seperate sprite which would be the projectile. It would be located in the barrel of the weapon. When the sprite (which will shoot) wants to shoot, you could broadcast a message. When the projectile receives the message, it would move an infinite amount of steps and would hide when it touches the enemy. Something like this:

For sprite that will shoot:
whenclickedifkeypressed?thenbroadcastShoot!

For bullet:
whenIreceiveShoot!move1000000...stepsforeveriftouchingenemy?thenhide
Hope I helped!
CatsUnited
Scratcher
1000+ posts

How to make a sprite shoot projectiles

You can create a costume in the sprite that's firing it, then you can do this….

whenclickedforeverifkeypressed?thencreatecloneofmyself
whenIstartasacloneswitchcostumetobulletpointtowardsmousepointerrepeatuntiltouching?move22stepswait0secsdeletethisclone
I recommend a variable that restrics firing bullets to avoid lag.
EndermanLife
Scratcher
13 posts

How to make a sprite shoot projectiles

Here : http://scratch.mit.edu/projects/53008220/ : You're welcome to use any scripts inside
nighthawk075
Scratcher
18 posts

How to make a sprite shoot projectiles

Thanks guys you were a big help.
Aquaventurer
Scratcher
9 posts

How to make a sprite shoot projectiles

Thank you so much..
SolarFlame-
Scratcher
19 posts

How to make a sprite shoot projectiles

CatsUnited wrote:

You can create a costume in the sprite that's firing it, then you can do this….

whenclickedforeverifkeypressed?thencreatecloneofmyself
whenIstartasacloneswitchcostumetobulletpointtowardsmousepointerrepeatuntiltouching?move22stepswait0secsdeletethisclone
I recommend a variable that restrics firing bullets to avoid lag.

That could miss it though. I would recommend this:

whenclickedforeverifkeypressed?thencreatecloneofmyself

whenIstartasacloneswitchcostumetobulletpointtowardsmousepointerbulletdetection
Edit this block to “Run without screen refresh”:
definebulletdetectionrepeatuntiltouchingenemy?move1stepsdeletethisclone
Ventor_10
Scratcher
2 posts

How to make a sprite shoot projectiles

Hey guys!

I just want to know how to make sprites shoot diagonally and forward for my game that i am making called “Bit Wars”.

So, if anyone knows, PLEASE TELL ME!!

Cheers!
fudgeman126
New Scratcher
1 post

How to make a sprite shoot projectiles

How do i make an ENEMY sprite shoot tho?

Powered by DjangoBB