how to make a bomb?
id: 630584
category: Help with Scripts
posts: 18
Ducky0112
loading
when green flag clickedI want to make a bomb that kills anything close to it.
say [bomb does nothing]
legendary34678
loading
What do you mean by a bomb? You can make sprites hide when they're touching the bomb sprite I suppose, but you weren't too clear with your question.
RT_Borg
loading
Hi Ducky0112,
Something like this?
Demo: Explosion
https://scratch.mit.edu/projects/734784484
If you use the explosion costumes or sound, don't forget to copy the Notes and Credits into your project.
– RT_Borg
Something like this?
Demo: Explosion
https://scratch.mit.edu/projects/734784484
If you use the explosion costumes or sound, don't forget to copy the Notes and Credits into your project.
– RT_Borg
Ducky0112
loading
Ok Thank you Hi Ducky0112,
Something like this?
Demo: Explosion
https://scratch.mit.edu/projects/734784484
If you use the explosion costumes or sound, don't forget to copy the Notes and Credits into your project.
– RT_Borg
Ducky0112
loading
I mean that any clone would be destroyed if near the bomb when exploding. What do you mean by a bomb? You can make sprites hide when they're touching the bomb sprite I suppose, but you weren't too clear with your question.
when green flag clicked
if <near bomb> then
explode and be gone
end
pearldealer
loading
So make a variable an have it be the area and have it hide specific sprites within the areaI mean that any clone would be destroyed if near the bomb when exploding. What do you mean by a bomb? You can make sprites hide when they're touching the bomb sprite I suppose, but you weren't too clear with your question.when green flag clicked
if <near bomb> then
explode and be gone
end
RT_Borg
loading
So make a variable an have it be the area and have it hide specific sprites within the area
Hi pearldealer, you almost never want to hide clones. Unless a clone is being hidden briefly to be shown again later, you generally want to “delete this clone”. The danger is using up your 300 clone limit. I've seen so many projects here on Help with Scripts with strange bugs caused when clones were hidden instead of deleted.
– RT_Borg
Jereb-co7
loading
Are you trying to anger the scratch lords?
SMGHecTa
loading
Everything that the bomb touch
G O N E
G O N E
WsDanzel
loading
Everything that the bomb touch: Everything that the bomb touch
G O N E
explode
MrKingofScratch
loading
You can put this code in the sprite that will have the destroy-able objects.
This will detect if the object is within 30 units (I think it's measured In pixels but i'm not sure) of the bomb when it explodes. If it is, it destroys the object. You can make the number “30” bigger or smaller if you want the explosion radius to be bigger or smaller.
Then put this code in the explosion script in the bomb sprite:
when I receive [bomb exploded v]
if ((distance to [bomb v]) < (30)) then
//"bomb" refers to the bomb sprite. If it's named something else, change this code.
delete this clone
//this is where you put the code that destroys the object. if it's not a clone, you can use "hide" block
end
This will detect if the object is within 30 units (I think it's measured In pixels but i'm not sure) of the bomb when it explodes. If it is, it destroys the object. You can make the number “30” bigger or smaller if you want the explosion radius to be bigger or smaller.
Then put this code in the explosion script in the bomb sprite:
broadcast [bomb exploded v]This just triggered the script that's responsible for destroying the objects in range of the bomb.
Potahtoe_
loading
when green flag clickedI want to make a bomb that kills anything close to it.
say [bomb does nothing]
ig you could make a “bomb sprite” and after a set amount of time (or if a condition is met), if the player is in the range (you could do this with hitboxes maybe? or you can compare the different x and y values) it'll detonate and do you what you want it to do
not the most helpful post but it should hopefully give you a simple understanding of how you can implement it.
SMGHecTa
loading
Nobody cares, asked, and smelledEverything that the bomb touch: Everything that the bomb touch
G O N E
explode
SMGHecTa
loading
darn it i was sayin about the virsu
froggyhatto
loading
when green flag clicked
glide () secs to x: (0) y: (-190)
switch costume to [explosion]
if <touching [anything] ?> then
broadcast [ dead]
end
JIM-13
loading
is there anything to make a falling bomb?
Norse7
loading
you could add gravity like so:
set [ gravityIncrement] to [2]
set [ gravity] to [0]
forever
change [ gravity] by ((0) - (gravityIncrement))
change y by (gravity)
end
Malicondi
loading
Please stop necroposting, this topic is several years old.