This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-09-28 05:01:54

aarmoss
New Scratcher
Registered: 2012-09-27
Posts: 4

How do I stop a script after one sprite has touched all of the others

I'm working on my first project. It's a game where one sprite moves and the other sprites don't. Is there a way to stop the script after the moving sprite has touched all of the other sprites?

Offline

 

#2 2012-09-28 07:58:12

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: How do I stop a script after one sprite has touched all of the others

when gf clicked
forever
script you want to stop goes here
if <<<touching [sprite 1 v]?> and <touching [sprite 2 v]?>> and <<touching [sprite 3 v]?> and <touching [sprite 4 v]?>>>
stop script
end

Last edited by MoreGamesNow (2012-09-28 07:58:24)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-09-28 19:10:03

aarmoss
New Scratcher
Registered: 2012-09-27
Posts: 4

Re: How do I stop a script after one sprite has touched all of the others

When I try that it doesn't work unless the moving sprite is touching all of the other ones at the same time. I want to stop all scripts after it has touched all of the other sprites but not necessarily touching them at the same time.

Offline

 

#4 2012-09-28 19:27:46

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

Re: How do I stop a script after one sprite has touched all of the others

when gf clicked
set [touched s1 v] to [no]
set [touched s2 v] to [no]
set [touched s3 v] to [no]
set [touched s4 v] to [no]
forever
script
if <touching [ sprite 1 v]?>
set [touched s1 v] to [yes]
end
if <touching [ sprite 2 v]?>
set [touched s2 v] to [yes]
end
if <touching [ sprite 3 v]?>
set [touched s3 v] to [yes]
end
if <touching [ sprite 4 v]?>
set [touched s4 v] to [yes]
end
and then add a script into there that ends the script if all the variables = yes

Offline

 

#5 2012-09-28 19:34:21

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How do I stop a script after one sprite has touched all of the others

MoreGamesNow wrote:

when gf clicked
forever
script you want to stop goes here
if <<<touching [sprite 1 v]?> or <touching [sprite 2 v]?>> or <<touching [sprite 3 v]?> or <touching [sprite 4 v]?>>>
stop script
end

I fixed the script to make it work.

Last edited by ErnieParke (2012-09-28 19:34:47)


http://i46.tinypic.com/35ismmc.png

Offline

 

#6 2012-09-28 21:27:10

aarmoss
New Scratcher
Registered: 2012-09-27
Posts: 4

Re: How do I stop a script after one sprite has touched all of the others

It worked using the variables. Thanks!

Offline

 

Board footer