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

#1 2011-10-06 17:00:45

naverd01
New Scratcher
Registered: 2011-10-04
Posts: 4

How to make sprite stop when background changes??

Hi,

Im making a car game where there is traffic (driving forever across the screen), and on the next level there is a different type of road, so new scripts are needed to make the traffic work. When the player touches the end of the road, the background changes, but the traffic does not stop from the previous level. I have used:

When I Recieve LEVEL 2
Hide
Stop Script,

but this does not seem to make the car stop. many thanks

Offline

 

#2 2011-10-06 17:04:21

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: How to make sprite stop when background changes??

naverd01 wrote:

Hi,

Im making a car game where there is traffic (driving forever across the screen), and on the next level there is a different type of road, so new scripts are needed to make the traffic work. When the player touches the end of the road, the background changes, but the traffic does not stop from the previous level. I have used:

When I Recieve LEVEL 2
Hide
Stop Script,

but this does not seem to make the car stop. many thanks

Could you upload a demo, and show me the actual project - that would be more help  smile


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#3 2011-10-06 17:09:14

naverd01
New Scratcher
Registered: 2011-10-04
Posts: 4

Re: How to make sprite stop when background changes??

http://scratch.mit.edu/projects/naverd01/2067645

Offline

 

#4 2011-10-07 10:24:33

naverd01
New Scratcher
Registered: 2011-10-04
Posts: 4

Re: How to make sprite stop when background changes??

Bump

Offline

 

#5 2011-10-07 15:38:56

naverd01
New Scratcher
Registered: 2011-10-04
Posts: 4

Re: How to make sprite stop when background changes??

Anyone????

Offline

 

#6 2011-10-07 16:41:27

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: How to make sprite stop when background changes??

[stop script] actually only works for the script it is put it - in other words, when [stop script] is used in script A, it stops script A and script A only.

Try putting your car movement code inside a block like this:

[blocks]<repeat until><( costume number of background <=> 2 )>
       your car movement script goes here
<end>
<hide>
[/blocks]


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

#7 2011-10-07 16:41:49

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: How to make sprite stop when background changes??

I'm guessing you want the gray car to stop on the second background, right?

Well, all you need to do is tell the gray car to stop when it's the second background.

You have a "repeat until" script on the gray car, right? Put a "costume of stage=2" in there

Then after it, put hide.

Offline

 

Board footer