Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » ...
- Xenogeneticon
-
Scratcher
100+ posts
...
i'm remaking the classic asteroids game, and I have like, 15 total asteroids and if one of them touches the spaceship it will blow up. I just need to know how would I do this:
I just don't know how I would use an if then block without making the test seem like it's going on forever
if <touching [an asteroid??? v] ?> then
switch costume to [blown_up_ship v]
end
I just don't know how I would use an if then block without making the test seem like it's going on forever
Last edited by Xenogeneticon (July 7, 2022 13:26:30)
- cIoudyness
-
Scratcher
500+ posts
...
i'm remaking the classic asteroids game, and I have like, 15 total asteroids and if one of them touches the spaceship it will blow up. I just need to know how would I do this:clones broadcast a message when they touch the spaceship?if <touching [an asteroid??? v] ?> then
switch costume to [blown_up_ship v]
end
I just don't know how I would use an if then block without making the test seem like it's going on forever
Last edited by cIoudyness (July 7, 2022 15:03:46)
- Abdullah_Cumhur
-
Scratcher
6 posts
...
I think you can replace the code with this:
or if you are using clones just replace the “When green flag clicked” with “When I start as a clone”:
when green flag clicked
forever
if <touching [Astreoid v] ?> then
switch costume to [blown_up_ship v]
stop [this script v]
end
end
or if you are using clones just replace the “When green flag clicked” with “When I start as a clone”:
when I start as a clone
forever
if <touching [Astreoid v] ?> then
switch costume to [blown_up_ship v]
stop [this script v]
end
end
Last edited by Abdullah_Cumhur (July 7, 2022 19:47:54)
- UwUAriana_Isback
-
Scratcher
36 posts
...
what are you going to check
UwU So he can see how To create the Code Scripts -_-
- cIoudyness
-
Scratcher
500+ posts
...
from what I know a sprite doesn’t detect touching another sprite’s clones. this means the clones need to be the ones sensing the touch.
therefore have the clones broadcast a message to the spaceship when said clones detect they’re touching it. off that broadcast, the rocket can then explode.
therefore have the clones broadcast a message to the spaceship when said clones detect they’re touching it. off that broadcast, the rocket can then explode.
- Discussion Forums
- » Help with Scripts
-
» ...





