Discuss Scratch

EpixtheMaster
Scratcher
10 posts

How Can You Create Spread Projectiles

So, I am making a boss fight. I can make it shoot projectiles and such, but I am not sure on how to give them a spread. Like four being shot, in that spread.
Thingied
Scratcher
1000+ posts

How Can You Create Spread Projectiles

I think this will work:
point towards [player v]
turn cw (pick random (()-(spread)) to (spread)) degrees
shoot
TheAnomalousPseudo
Scratcher
1000+ posts

How Can You Create Spread Projectiles

Create four clones, give them subID 1-4.

when I start as a clone
point towards [mouse-pointer v]
turn cw (((subID) * (10)) - (25)) degrees //10 is amount of spread, 25 keeps it centered. If you change 10, you'll need to change 25

Double-click on the comment and Ctrl+Shift+Right arrow to see the rest.

Last edited by TheAnomalousPseudo (June 4, 2021 02:43:30)

Unithlees3
Scratcher
1000+ posts

How Can You Create Spread Projectiles

//like this:
go to [Player v]
turn @turnRight (pick random (-50) to (50)) degrees
forever
move (5) steps
end
EpixtheMaster
Scratcher
10 posts

How Can You Create Spread Projectiles

Ok, I messed up the sentence. I want this boss to shoot four equally spread projectiles at the same time.
EpixtheMaster
Scratcher
10 posts

How Can You Create Spread Projectiles

(nvm)
Jimmy541559
Scratcher
13 posts

How Can You Create Spread Projectiles

Is by having the {pick direction in that } and thats how
Jimmy541559
Scratcher
13 posts

How Can You Create Spread Projectiles

pick random (direction of something - # amount) to (direction of something + # amount)
like this
Stupid_Pie
Scratcher
26 posts

How Can You Create Spread Projectiles

TheAnomalousPseudo wrote:

Create four clones, give them subID 1-4.

when I start as a clone
point towards [mouse-pointer v]
turn cw (((subID) * (10)) - (25)) degrees //10 is the amount of spread, 25 keeps it centered. If you change 10, you'll need to change 25

Double-click on the comment and Ctrl+Shift+Right arrow to see the rest.
Jimmy541559
Scratcher
13 posts

How Can You Create Spread Projectiles

ok thx for making it simpler
Stupid_Pie
Scratcher
26 posts

How Can You Create Spread Projectiles

I would try this for a spread effect. First, make two or three sprites name one bullet, and name one player you may implement a gun sprite. This is the player's basic code you may implement a movement script.
when green flag clicked
forever
point towards [mousepointer]
end

Now for the bullets make two variables for simplicity I'll use ID and Sub ID, this script needs troubleshooting. Also, you can add smooth turning if you want
when green flag clicked
hide
go to [player]
forever
put your activation script here
point in direction ([direction v] of [Sprite1 v])
make bullets ( )
set [Sub ID v] to (((Sub ID) / (10)) * (55))
your delay time
end

Now time to link ID to how many clones the bullet spread makes.
define make bullets (how many bullets)
set [ID v] to [0]
repeat (how many bullets)
change [ID v] by (1)
create clone of [myself v]
end

when I start as a clone
turn cw (((ID) * (10)) - (Sub ID)) degrees
show
repeat until <<touching [edge v] ?> or <touching [enemy v] ?>>
move (5) steps
end
delete this clone

Idk if I was helpful in any way or not but i hope this helped in some way -
Stupid_Pie

Last edited by Stupid_Pie (Dec. 4, 2023 18:42:38)

Rizztaco
Scratcher
12 posts

How Can You Create Spread Projectiles

First off, DONT use a repeat block for bullets, copy paste the clone block (there might be a more efficient method) and make it rotate randomly from negative (number) to positive (number) for each clone
Rizztaco
Scratcher
12 posts

How Can You Create Spread Projectiles

First off, DONT use a repeat block for bullets, copy paste the clone block (there might be a more efficient method) and make it rotate randomly from negative (number) to positive (number) for each clone
Stupid_Pie
Scratcher
26 posts

How Can You Create Spread Projectiles

but they said for a equal spread of bullets because they said that was a mistake. idk what u mean???

Last edited by Stupid_Pie (Dec. 4, 2023 21:49:27)

Stupid_Pie
Scratcher
26 posts

How Can You Create Spread Projectiles

also repeat block is all around the same as copy and pasting bullets. But but you make but you can assign a variable to it, im confused.

Last edited by Stupid_Pie (Dec. 4, 2023 21:52:05)

Powered by DjangoBB