Discuss Scratch

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:

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)

god1322
Scratcher
32 posts

...

Bro, please share the game link.
Xenogeneticon
Scratcher
100+ posts

...

what are you going to check
cIoudyness
Scratcher
500+ posts

...

Xenogeneticon wrote:

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:

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
clones broadcast a message when they touch the spaceship?

Last edited by cIoudyness (July 7, 2022 15:03:46)

deck26
Scratcher
1000+ posts

...

Perhaps a script with wait until touching spaceship?
Abdullah_Cumhur
Scratcher
6 posts

...

I think you can replace the code with this:

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

...

Xenogeneticon wrote:

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.

Powered by DjangoBB